diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 8b71eca6..d8c39664 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -26,7 +26,10 @@ jobs: automerge: runs-on: ubuntu-latest steps: - - name: automerge - uses: "pascalgn/automerge-action@v0.12.0" + - id: automerge + name: automerge + uses: "pascalgn/automerge-action@v0.16.3" + permissions: + contents: write env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.gitignore b/.gitignore index bdd682cf..04a412db 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,9 @@ build/ .out docs/.vuepress/dist/ node_modules/ -package.json yarn.lock dependency-graph.png mytestnet buf-stamp +artifacts +.states diff --git a/CHANGELOG.md b/CHANGELOG.md index 31c1bb24..146a5a84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,33 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog +## [v1.9.0] + +### Improvements + +* [\#387](https://github.com/irisnet/irismod/pull/387) Preparatory work for realizing erc20. +* [\#393](https://github.com/irisnet/irismod/pull/393) Implement DeployERC20 by gov proposal . +* [\#394](https://github.com/irisnet/irismod/pull/394) Support swap native token from erc20 token. +* [\#395](https://github.com/irisnet/irismod/pull/395) Implement SwapToERC20. +* [\#400](https://github.com/irisnet/irismod/pull/400) Implement swap native token from erc20 contract. +* [\#402](https://github.com/irisnet/irismod/pull/402) Add cli for swap from/to ERC20. +* [\#404](https://github.com/irisnet/irismod/pull/404) Implement token Balances api. +* [\#405](https://github.com/irisnet/irismod/pull/405) Rolled back the cosmos-sdk version to v0.47.9. +* [\#409](https://github.com/irisnet/irismod/pull/409) Add a switch for enabling erc20 swap function. +* [\#410](https://github.com/irisnet/irismod/pull/410) Implement upgradeable contract. +* [\#411](https://github.com/irisnet/irismod/pull/411) Implement erc20 upgrade. +* [\#412](https://github.com/irisnet/irismod/pull/412) Optimize contract code +* [\#417](https://github.com/irisnet/irismod/pull/417) Optimize token command line + +### Bug Fixes + +* [\#401](https://github.com/irisnet/irismod/pull/401) Add token test & fix error. +* [\#407](https://github.com/irisnet/irismod/pull/407) Fix some bugs about erc20 in token module. + +### API Breaking Changes + +* [\#403](https://github.com/irisnet/irismod/pull/403) Standardized parameter naming + ## [v1.8.0] ### Improvements diff --git a/Makefile b/Makefile index 61addf7f..e3e4e325 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ distclean: clean ### Protobuf ### ############################################################################### -protoVer=0.11.2 +protoVer=0.13.0 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) @@ -116,7 +116,35 @@ lint: golangci-lint format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./lite/*/statik.go" -not -path "*.pb.go" | xargs gofmt -w -s find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./lite/*/statik.go" -not -path "*.pb.go" | xargs misspell -w - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./lite/*/statik.go" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/irismod + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./lite/*/statik.go" -not -path "*.pb.go" -not -path "*.pulsar.go" | xargs goimports -w -local github.com/irisnet/irismod benchmark: @go test -mod=readonly -bench=. ./... + +############################################################################### +### Compile Solidity Contracts ### +############################################################################### + +CONTRACTS_DIR := contracts +COMPILED_DIR := $(CONTRACTS_DIR)/compiled_contracts + +# Compile and format solidity contracts for the erc20 module. Also install +# openzeppeling as the contracts are build on top of openzeppelin templates. +contracts-compile: contracts-clean dep-install create-contracts-abi + +# Install openzeppelin solidity contracts +dep-install: + @echo "Importing openzeppelin contracts..." + @npm install + +# Clean tmp files +contracts-clean: + @rm -rf node_modules + +# Compile, filter out and format contracts into the following format. +create-contracts-abi: + solc --combined-json abi,bin --optimize --optimize-runs 200 --evm-version paris --include-path node_modules --base-path $(CONTRACTS_DIR)/ $(CONTRACTS_DIR)/Token.sol | jq '.contracts["Token.sol:Token"]' > $(COMPILED_DIR)/Token.json \ + && solc --combined-json abi,bin --optimize --optimize-runs 200 --evm-version paris --include-path node_modules --base-path $(CONTRACTS_DIR)/ $(CONTRACTS_DIR)/TokenProxy.sol | jq '.contracts["TokenProxy.sol:TokenProxy"]' > $(COMPILED_DIR)/TokenProxy.json \ + && solc --combined-json abi,bin --optimize --optimize-runs 200 --evm-version paris --include-path node_modules --base-path $(CONTRACTS_DIR)/ $(CONTRACTS_DIR)/UpgradeableBeacon.sol | jq '.contracts["UpgradeableBeacon.sol:UpgradeableBeacon"]' > $(COMPILED_DIR)/UpgradeableBeacon.json \ + + diff --git a/api/irismod/coinswap/coinswap.pulsar.go b/api/irismod/coinswap/coinswap.pulsar.go index cd30b8fb..c30c5720 100644 --- a/api/irismod/coinswap/coinswap.pulsar.go +++ b/api/irismod/coinswap/coinswap.pulsar.go @@ -2621,19 +2621,19 @@ var file_irismod_coinswap_coinswap_proto_rawDesc = []byte{ 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x16, 0x75, 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x46, 0x65, 0x65, 0x3a, 0x08, - 0x98, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xbb, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, - 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, - 0x70, 0x42, 0x0d, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, - 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x73, - 0x77, 0x61, 0x70, 0xa2, 0x02, 0x03, 0x49, 0x43, 0x58, 0xaa, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xca, 0x02, 0x10, 0x49, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xe2, - 0x02, 0x1c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, - 0x61, 0x70, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x11, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, - 0x61, 0x70, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x98, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xbb, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, + 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, + 0x6e, 0x73, 0x77, 0x61, 0x70, 0x42, 0x0d, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, + 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x63, + 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xa2, 0x02, 0x03, 0x49, 0x43, 0x58, 0xaa, 0x02, 0x10, + 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, + 0xca, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, 0x69, 0x6e, 0x73, + 0x77, 0x61, 0x70, 0xe2, 0x02, 0x1c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, + 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x11, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x43, 0x6f, + 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/irismod/coinswap/tx.pulsar.go b/api/irismod/coinswap/tx.pulsar.go index 8826a56e..a0002c33 100644 --- a/api/irismod/coinswap/tx.pulsar.go +++ b/api/irismod/coinswap/tx.pulsar.go @@ -7189,19 +7189,19 @@ var file_irismod_coinswap_tx_proto_rawDesc = []byte{ 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xb5, 0x01, 0x0a, 0x14, - 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, - 0x73, 0x77, 0x61, 0x70, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, - 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, - 0xa2, 0x02, 0x03, 0x49, 0x43, 0x58, 0xaa, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xca, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xe2, 0x02, 0x1c, 0x49, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x49, 0x72, - 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xc8, - 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xb5, 0x01, 0xc8, 0xe1, + 0x1e, 0x00, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, + 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x63, 0x6f, 0x69, 0x6e, + 0x73, 0x77, 0x61, 0x70, 0xa2, 0x02, 0x03, 0x49, 0x43, 0x58, 0xaa, 0x02, 0x10, 0x49, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xca, 0x02, 0x10, + 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, + 0xe2, 0x02, 0x1c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, 0x69, 0x6e, 0x73, + 0x77, 0x61, 0x70, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x11, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x43, 0x6f, 0x69, 0x6e, 0x73, + 0x77, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/irismod/farm/farm.pulsar.go b/api/irismod/farm/farm.pulsar.go index 4431c535..398be638 100644 --- a/api/irismod/farm/farm.pulsar.go +++ b/api/irismod/farm/farm.pulsar.go @@ -5224,17 +5224,17 @@ var file_irismod_farm_farm_proto_rawDesc = []byte{ 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, 0x42, 0x6f, 0x6e, 0x64, 0x3a, - 0x08, 0x98, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0x9f, 0x01, 0x0a, 0x10, 0x63, 0x6f, - 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x66, 0x61, 0x72, 0x6d, 0x42, 0x09, - 0x46, 0x61, 0x72, 0x6d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, - 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x2f, 0x66, 0x61, 0x72, 0x6d, 0xa2, 0x02, 0x03, 0x49, 0x46, 0x58, 0xaa, 0x02, - 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x46, 0x61, 0x72, 0x6d, 0xca, 0x02, 0x0c, - 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x46, 0x61, 0x72, 0x6d, 0xe2, 0x02, 0x18, 0x49, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x46, 0x61, 0x72, 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x3a, 0x3a, 0x46, 0x61, 0x72, 0x6d, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x08, 0x98, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0x9f, 0x01, 0xc8, 0xe1, 0x1e, 0x00, + 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x66, 0x61, + 0x72, 0x6d, 0x42, 0x09, 0x46, 0x61, 0x72, 0x6d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, + 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x66, 0x61, 0x72, 0x6d, 0xa2, 0x02, 0x03, 0x49, + 0x46, 0x58, 0xaa, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x46, 0x61, 0x72, + 0x6d, 0xca, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x46, 0x61, 0x72, 0x6d, + 0xe2, 0x02, 0x18, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x46, 0x61, 0x72, 0x6d, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x49, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x46, 0x61, 0x72, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/api/irismod/farm/tx.pulsar.go b/api/irismod/farm/tx.pulsar.go index ae372636..c5cf78c6 100644 --- a/api/irismod/farm/tx.pulsar.go +++ b/api/irismod/farm/tx.pulsar.go @@ -9099,16 +9099,16 @@ var file_irismod_farm_tx_proto_rawDesc = []byte{ 0x6d, 0x73, 0x1a, 0x25, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x66, 0x61, 0x72, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, - 0x42, 0x9d, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x66, 0x61, 0x72, 0x6d, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, - 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x66, 0x61, 0x72, 0x6d, 0xa2, 0x02, 0x03, - 0x49, 0x46, 0x58, 0xaa, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x46, 0x61, - 0x72, 0x6d, 0xca, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x46, 0x61, 0x72, - 0x6d, 0xe2, 0x02, 0x18, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x46, 0x61, 0x72, 0x6d, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x49, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x46, 0x61, 0x72, 0x6d, 0xc8, 0xe1, 0x1e, 0x00, + 0x42, 0x9d, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x66, 0x61, 0x72, 0x6d, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x66, 0x61, 0x72, + 0x6d, 0xa2, 0x02, 0x03, 0x49, 0x46, 0x58, 0xaa, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x2e, 0x46, 0x61, 0x72, 0x6d, 0xca, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x5c, 0x46, 0x61, 0x72, 0x6d, 0xe2, 0x02, 0x18, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, + 0x46, 0x61, 0x72, 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x0d, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x46, 0x61, 0x72, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/api/irismod/htlc/htlc.pulsar.go b/api/irismod/htlc/htlc.pulsar.go index f78f5623..1c783639 100644 --- a/api/irismod/htlc/htlc.pulsar.go +++ b/api/irismod/htlc/htlc.pulsar.go @@ -4684,17 +4684,17 @@ var file_irismod_htlc_htlc_proto_rawDesc = []byte{ 0x10, 0x01, 0x1a, 0x0c, 0x8a, 0x9d, 0x20, 0x08, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x4f, 0x55, 0x54, 0x47, 0x4f, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x1a, 0x0c, 0x8a, 0x9d, 0x20, 0x08, 0x4f, 0x75, 0x74, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x1a, 0x04, 0x88, 0xa3, - 0x1e, 0x00, 0x42, 0x9f, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, - 0x6f, 0x64, 0x2e, 0x68, 0x74, 0x6c, 0x63, 0x42, 0x09, 0x48, 0x74, 0x6c, 0x63, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x68, 0x74, 0x6c, - 0x63, 0xa2, 0x02, 0x03, 0x49, 0x48, 0x58, 0xaa, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x2e, 0x48, 0x74, 0x6c, 0x63, 0xca, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x5c, 0x48, 0x74, 0x6c, 0x63, 0xe2, 0x02, 0x18, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, - 0x48, 0x74, 0x6c, 0x63, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x0d, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x48, 0x74, 0x6c, 0x63, - 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x1e, 0x00, 0x42, 0x9f, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x69, + 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x68, 0x74, 0x6c, 0x63, 0x42, 0x09, 0x48, 0x74, 0x6c, + 0x63, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2f, 0x68, 0x74, 0x6c, 0x63, 0xa2, 0x02, 0x03, 0x49, 0x48, 0x58, 0xaa, 0x02, 0x0c, 0x49, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x48, 0x74, 0x6c, 0x63, 0xca, 0x02, 0x0c, 0x49, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x48, 0x74, 0x6c, 0x63, 0xe2, 0x02, 0x18, 0x49, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x5c, 0x48, 0x74, 0x6c, 0x63, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, + 0x48, 0x74, 0x6c, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/irismod/htlc/tx.pulsar.go b/api/irismod/htlc/tx.pulsar.go index 87ad2c95..1cb9916d 100644 --- a/api/irismod/htlc/tx.pulsar.go +++ b/api/irismod/htlc/tx.pulsar.go @@ -3543,17 +3543,17 @@ var file_irismod_htlc_tx_proto_rawDesc = []byte{ 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x25, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x68, 0x74, 0x6c, 0x63, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, - 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x9d, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, - 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x68, 0x74, 0x6c, 0x63, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x68, 0x74, - 0x6c, 0x63, 0xa2, 0x02, 0x03, 0x49, 0x48, 0x58, 0xaa, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, - 0x6f, 0x64, 0x2e, 0x48, 0x74, 0x6c, 0x63, 0xca, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x5c, 0x48, 0x74, 0x6c, 0x63, 0xe2, 0x02, 0x18, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x5c, 0x48, 0x74, 0x6c, 0x63, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x0d, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x48, 0x74, 0x6c, - 0x63, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x9d, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x10, 0x63, 0x6f, + 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x68, 0x74, 0x6c, 0x63, 0x42, 0x07, + 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x2f, 0x68, 0x74, 0x6c, 0x63, 0xa2, 0x02, 0x03, 0x49, 0x48, 0x58, 0xaa, 0x02, 0x0c, 0x49, + 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x48, 0x74, 0x6c, 0x63, 0xca, 0x02, 0x0c, 0x49, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x48, 0x74, 0x6c, 0x63, 0xe2, 0x02, 0x18, 0x49, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x48, 0x74, 0x6c, 0x63, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, + 0x3a, 0x48, 0x74, 0x6c, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/irismod/mt/mt.pulsar.go b/api/irismod/mt/mt.pulsar.go index 64b1c050..26a22a35 100644 --- a/api/irismod/mt/mt.pulsar.go +++ b/api/irismod/mt/mt.pulsar.go @@ -1818,16 +1818,16 @@ var file_irismod_mt_mt_proto_rawDesc = []byte{ 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x6d, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0x91, 0x01, 0x0a, 0x0e, 0x63, - 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x6d, 0x74, 0x42, 0x07, 0x4d, - 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, - 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2f, 0x6d, 0x74, 0xa2, 0x02, 0x03, 0x49, 0x4d, 0x58, 0xaa, 0x02, 0x0a, 0x49, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x2e, 0x4d, 0x74, 0xca, 0x02, 0x0a, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x5c, 0x4d, 0x74, 0xe2, 0x02, 0x16, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4d, 0x74, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, 0x49, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x4d, 0x74, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, + 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0x91, 0x01, 0xc8, 0xe1, 0x1e, + 0x00, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x6d, + 0x74, 0x42, 0x07, 0x4d, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, + 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x6d, 0x74, 0xa2, 0x02, 0x03, 0x49, 0x4d, 0x58, 0xaa, 0x02, 0x0a, + 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x4d, 0x74, 0xca, 0x02, 0x0a, 0x49, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4d, 0x74, 0xe2, 0x02, 0x16, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x5c, 0x4d, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x0b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x4d, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/api/irismod/mt/tx.pulsar.go b/api/irismod/mt/tx.pulsar.go index 6fa2619c..98ea44e1 100644 --- a/api/irismod/mt/tx.pulsar.go +++ b/api/irismod/mt/tx.pulsar.go @@ -6473,16 +6473,16 @@ var file_irismod_mt_tx_proto_rawDesc = []byte{ 0x72, 0x6e, 0x4d, 0x54, 0x12, 0x15, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x6d, 0x74, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x4d, 0x54, 0x1a, 0x1d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x6d, 0x74, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, - 0x4d, 0x54, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x91, 0x01, 0x0a, 0x0e, 0x63, - 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x6d, 0x74, 0x42, 0x07, 0x54, - 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, - 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2f, 0x6d, 0x74, 0xa2, 0x02, 0x03, 0x49, 0x4d, 0x58, 0xaa, 0x02, 0x0a, 0x49, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x2e, 0x4d, 0x74, 0xca, 0x02, 0x0a, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x5c, 0x4d, 0x74, 0xe2, 0x02, 0x16, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4d, 0x74, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, 0x49, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x4d, 0x74, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, + 0x4d, 0x54, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x91, 0x01, 0xc8, 0xe1, 0x1e, + 0x00, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x6d, + 0x74, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, + 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x6d, 0x74, 0xa2, 0x02, 0x03, 0x49, 0x4d, 0x58, 0xaa, 0x02, 0x0a, + 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x4d, 0x74, 0xca, 0x02, 0x0a, 0x49, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4d, 0x74, 0xe2, 0x02, 0x16, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x5c, 0x4d, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x0b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x4d, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/api/irismod/nft/nft.pulsar.go b/api/irismod/nft/nft.pulsar.go index 6b7a91e6..80521cfc 100644 --- a/api/irismod/nft/nft.pulsar.go +++ b/api/irismod/nft/nft.pulsar.go @@ -5130,16 +5130,16 @@ var file_irismod_nft_nft_proto_rawDesc = []byte{ 0x14, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x6e, 0x66, 0x74, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4e, 0x46, 0x54, 0x42, 0x0c, 0xc8, 0xde, 0x1f, 0x00, 0xe2, 0xde, 0x1f, 0x04, 0x4e, 0x46, 0x54, 0x73, 0x52, 0x04, 0x6e, 0x66, 0x74, 0x73, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x42, - 0x98, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, - 0x6e, 0x66, 0x74, 0x42, 0x08, 0x4e, 0x66, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, - 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x6e, 0x66, 0x74, 0xa2, 0x02, 0x03, 0x49, 0x4e, - 0x58, 0xaa, 0x02, 0x0b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x4e, 0x66, 0x74, 0xca, - 0x02, 0x0b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4e, 0x66, 0x74, 0xe2, 0x02, 0x17, - 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4e, 0x66, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x3a, 0x3a, 0x4e, 0x66, 0x74, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x98, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2e, 0x6e, 0x66, 0x74, 0x42, 0x08, 0x4e, 0x66, 0x74, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x6e, 0x66, 0x74, 0xa2, + 0x02, 0x03, 0x49, 0x4e, 0x58, 0xaa, 0x02, 0x0b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, + 0x4e, 0x66, 0x74, 0xca, 0x02, 0x0b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4e, 0x66, + 0x74, 0xe2, 0x02, 0x17, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4e, 0x66, 0x74, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x49, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x4e, 0x66, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/api/irismod/nft/tx.pulsar.go b/api/irismod/nft/tx.pulsar.go index c5f565dc..7044fd80 100644 --- a/api/irismod/nft/tx.pulsar.go +++ b/api/irismod/nft/tx.pulsar.go @@ -7608,16 +7608,16 @@ var file_irismod_nft_tx_proto_rawDesc = []byte{ 0x6e, 0x73, 0x66, 0x65, 0x72, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x1a, 0x25, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x6e, 0x66, 0x74, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0x97, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x2e, 0x6e, 0x66, 0x74, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, - 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x6e, 0x66, 0x74, 0xa2, 0x02, 0x03, 0x49, - 0x4e, 0x58, 0xaa, 0x02, 0x0b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x4e, 0x66, 0x74, - 0xca, 0x02, 0x0b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4e, 0x66, 0x74, 0xe2, 0x02, - 0x17, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4e, 0x66, 0x74, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x49, 0x72, 0x69, 0x73, 0x6d, - 0x6f, 0x64, 0x3a, 0x3a, 0x4e, 0x66, 0x74, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x65, 0x42, 0x97, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x6e, 0x66, 0x74, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x6e, 0x66, 0x74, + 0xa2, 0x02, 0x03, 0x49, 0x4e, 0x58, 0xaa, 0x02, 0x0b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2e, 0x4e, 0x66, 0x74, 0xca, 0x02, 0x0b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4e, + 0x66, 0x74, 0xe2, 0x02, 0x17, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x4e, 0x66, 0x74, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x49, + 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x4e, 0x66, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/api/irismod/record/record.pulsar.go b/api/irismod/record/record.pulsar.go index f1e2024e..fe15eb88 100644 --- a/api/irismod/record/record.pulsar.go +++ b/api/irismod/record/record.pulsar.go @@ -1397,18 +1397,18 @@ var file_irismod_record_record_proto_rawDesc = []byte{ 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, - 0x6f, 0x72, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xad, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, - 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x42, - 0x0b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, - 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0xa2, 0x02, 0x03, - 0x49, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0xca, 0x02, 0x0e, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x52, - 0x65, 0x63, 0x6f, 0x72, 0x64, 0xe2, 0x02, 0x1a, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, - 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x0f, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x72, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xad, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, + 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x42, 0x0b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, + 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0xa2, 0x02, 0x03, 0x49, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0xca, 0x02, 0x0e, 0x49, 0x72, 0x69, 0x73, 0x6d, + 0x6f, 0x64, 0x5c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0xe2, 0x02, 0x1a, 0x49, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x5c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x3a, 0x3a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/irismod/record/tx.pulsar.go b/api/irismod/record/tx.pulsar.go index d3d64055..9a02264f 100644 --- a/api/irismod/record/tx.pulsar.go +++ b/api/irismod/record/tx.pulsar.go @@ -1108,18 +1108,18 @@ var file_irismod_record_tx_proto_rawDesc = []byte{ 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x1a, 0x27, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa9, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x69, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x42, 0x07, 0x54, - 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, - 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0xa2, 0x02, 0x03, 0x49, 0x52, 0x58, 0xaa, 0x02, 0x0e, - 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0xca, 0x02, - 0x0e, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0xe2, - 0x02, 0x1a, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x49, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0xc8, 0xe1, - 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa9, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x12, 0x63, + 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, + 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0xa2, 0x02, 0x03, 0x49, 0x52, + 0x58, 0xaa, 0x02, 0x0e, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x52, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0xca, 0x02, 0x0e, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x52, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0xe2, 0x02, 0x1a, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x0f, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x52, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/irismod/service/service.pulsar.go b/api/irismod/service/service.pulsar.go index 5bdf02d1..e4009128 100644 --- a/api/irismod/service/service.pulsar.go +++ b/api/irismod/service/service.pulsar.go @@ -9830,18 +9830,18 @@ var file_irismod_service_service_proto_rawDesc = []byte{ 0x53, 0x45, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x02, 0x1a, 0x0d, 0x8a, 0x9d, 0x20, 0x09, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x1a, 0x0c, 0x88, 0xa3, 0x1e, 0x00, 0xa8, 0xa4, 0x1e, 0x00, 0xb0, 0xa4, 0x1e, 0x01, 0x42, - 0xb4, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x49, 0x53, 0x58, 0xaa, 0x02, 0x0f, - 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, - 0x02, 0x0f, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0xe2, 0x02, 0x1b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0xb4, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, + 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x49, 0x53, + 0x58, 0xaa, 0x02, 0x0f, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0xca, 0x02, 0x0f, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/irismod/service/tx.pulsar.go b/api/irismod/service/tx.pulsar.go index 77c82bdc..7cfcb48a 100644 --- a/api/irismod/service/tx.pulsar.go +++ b/api/irismod/service/tx.pulsar.go @@ -16886,18 +16886,18 @@ var file_irismod_service_tx_proto_rawDesc = []byte{ 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x28, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xaf, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, - 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, - 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x49, 0x53, - 0x58, 0xaa, 0x02, 0x0f, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0xca, 0x02, 0x0f, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1b, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xaf, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, + 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, + 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, + 0x02, 0x03, 0x49, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x0f, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1b, 0x49, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/api/irismod/token/module/v1/module.pulsar.go b/api/irismod/token/module/v1/module.pulsar.go index 8f728e48..631fd853 100644 --- a/api/irismod/token/module/v1/module.pulsar.go +++ b/api/irismod/token/module/v1/module.pulsar.go @@ -517,7 +517,8 @@ type Module struct { unknownFields protoimpl.UnknownFields FeeCollectorName string `protobuf:"bytes,1,opt,name=fee_collector_name,json=feeCollectorName,proto3" json:"fee_collector_name,omitempty"` - // authority defines the custom module authority. If not set, defaults to the governance module. + // authority defines the custom module authority. If not set, defaults to the + // governance module. Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` } diff --git a/api/irismod/token/v1/event.pulsar.go b/api/irismod/token/v1/event.pulsar.go new file mode 100644 index 00000000..0ac1fbbb --- /dev/null +++ b/api/irismod/token/v1/event.pulsar.go @@ -0,0 +1,2286 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package tokenv1 + +import ( + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_EventDeployERC20 protoreflect.MessageDescriptor + fd_EventDeployERC20_symbol protoreflect.FieldDescriptor + fd_EventDeployERC20_name protoreflect.FieldDescriptor + fd_EventDeployERC20_scale protoreflect.FieldDescriptor + fd_EventDeployERC20_min_unit protoreflect.FieldDescriptor + fd_EventDeployERC20_contract protoreflect.FieldDescriptor +) + +func init() { + file_irismod_token_v1_event_proto_init() + md_EventDeployERC20 = File_irismod_token_v1_event_proto.Messages().ByName("EventDeployERC20") + fd_EventDeployERC20_symbol = md_EventDeployERC20.Fields().ByName("symbol") + fd_EventDeployERC20_name = md_EventDeployERC20.Fields().ByName("name") + fd_EventDeployERC20_scale = md_EventDeployERC20.Fields().ByName("scale") + fd_EventDeployERC20_min_unit = md_EventDeployERC20.Fields().ByName("min_unit") + fd_EventDeployERC20_contract = md_EventDeployERC20.Fields().ByName("contract") +} + +var _ protoreflect.Message = (*fastReflection_EventDeployERC20)(nil) + +type fastReflection_EventDeployERC20 EventDeployERC20 + +func (x *EventDeployERC20) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventDeployERC20)(x) +} + +func (x *EventDeployERC20) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_event_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventDeployERC20_messageType fastReflection_EventDeployERC20_messageType +var _ protoreflect.MessageType = fastReflection_EventDeployERC20_messageType{} + +type fastReflection_EventDeployERC20_messageType struct{} + +func (x fastReflection_EventDeployERC20_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventDeployERC20)(nil) +} +func (x fastReflection_EventDeployERC20_messageType) New() protoreflect.Message { + return new(fastReflection_EventDeployERC20) +} +func (x fastReflection_EventDeployERC20_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventDeployERC20 +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventDeployERC20) Descriptor() protoreflect.MessageDescriptor { + return md_EventDeployERC20 +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventDeployERC20) Type() protoreflect.MessageType { + return _fastReflection_EventDeployERC20_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventDeployERC20) New() protoreflect.Message { + return new(fastReflection_EventDeployERC20) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventDeployERC20) Interface() protoreflect.ProtoMessage { + return (*EventDeployERC20)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventDeployERC20) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Symbol != "" { + value := protoreflect.ValueOfString(x.Symbol) + if !f(fd_EventDeployERC20_symbol, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_EventDeployERC20_name, value) { + return + } + } + if x.Scale != uint32(0) { + value := protoreflect.ValueOfUint32(x.Scale) + if !f(fd_EventDeployERC20_scale, value) { + return + } + } + if x.MinUnit != "" { + value := protoreflect.ValueOfString(x.MinUnit) + if !f(fd_EventDeployERC20_min_unit, value) { + return + } + } + if x.Contract != "" { + value := protoreflect.ValueOfString(x.Contract) + if !f(fd_EventDeployERC20_contract, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventDeployERC20) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "irismod.token.v1.EventDeployERC20.symbol": + return x.Symbol != "" + case "irismod.token.v1.EventDeployERC20.name": + return x.Name != "" + case "irismod.token.v1.EventDeployERC20.scale": + return x.Scale != uint32(0) + case "irismod.token.v1.EventDeployERC20.min_unit": + return x.MinUnit != "" + case "irismod.token.v1.EventDeployERC20.contract": + return x.Contract != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventDeployERC20 does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventDeployERC20) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "irismod.token.v1.EventDeployERC20.symbol": + x.Symbol = "" + case "irismod.token.v1.EventDeployERC20.name": + x.Name = "" + case "irismod.token.v1.EventDeployERC20.scale": + x.Scale = uint32(0) + case "irismod.token.v1.EventDeployERC20.min_unit": + x.MinUnit = "" + case "irismod.token.v1.EventDeployERC20.contract": + x.Contract = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventDeployERC20 does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventDeployERC20) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "irismod.token.v1.EventDeployERC20.symbol": + value := x.Symbol + return protoreflect.ValueOfString(value) + case "irismod.token.v1.EventDeployERC20.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "irismod.token.v1.EventDeployERC20.scale": + value := x.Scale + return protoreflect.ValueOfUint32(value) + case "irismod.token.v1.EventDeployERC20.min_unit": + value := x.MinUnit + return protoreflect.ValueOfString(value) + case "irismod.token.v1.EventDeployERC20.contract": + value := x.Contract + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventDeployERC20 does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventDeployERC20) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "irismod.token.v1.EventDeployERC20.symbol": + x.Symbol = value.Interface().(string) + case "irismod.token.v1.EventDeployERC20.name": + x.Name = value.Interface().(string) + case "irismod.token.v1.EventDeployERC20.scale": + x.Scale = uint32(value.Uint()) + case "irismod.token.v1.EventDeployERC20.min_unit": + x.MinUnit = value.Interface().(string) + case "irismod.token.v1.EventDeployERC20.contract": + x.Contract = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventDeployERC20 does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventDeployERC20) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.EventDeployERC20.symbol": + panic(fmt.Errorf("field symbol of message irismod.token.v1.EventDeployERC20 is not mutable")) + case "irismod.token.v1.EventDeployERC20.name": + panic(fmt.Errorf("field name of message irismod.token.v1.EventDeployERC20 is not mutable")) + case "irismod.token.v1.EventDeployERC20.scale": + panic(fmt.Errorf("field scale of message irismod.token.v1.EventDeployERC20 is not mutable")) + case "irismod.token.v1.EventDeployERC20.min_unit": + panic(fmt.Errorf("field min_unit of message irismod.token.v1.EventDeployERC20 is not mutable")) + case "irismod.token.v1.EventDeployERC20.contract": + panic(fmt.Errorf("field contract of message irismod.token.v1.EventDeployERC20 is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventDeployERC20 does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventDeployERC20) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.EventDeployERC20.symbol": + return protoreflect.ValueOfString("") + case "irismod.token.v1.EventDeployERC20.name": + return protoreflect.ValueOfString("") + case "irismod.token.v1.EventDeployERC20.scale": + return protoreflect.ValueOfUint32(uint32(0)) + case "irismod.token.v1.EventDeployERC20.min_unit": + return protoreflect.ValueOfString("") + case "irismod.token.v1.EventDeployERC20.contract": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventDeployERC20 does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventDeployERC20) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.EventDeployERC20", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventDeployERC20) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventDeployERC20) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventDeployERC20) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventDeployERC20) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventDeployERC20) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Symbol) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Scale != 0 { + n += 1 + runtime.Sov(uint64(x.Scale)) + } + l = len(x.MinUnit) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Contract) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventDeployERC20) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Contract) > 0 { + i -= len(x.Contract) + copy(dAtA[i:], x.Contract) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Contract))) + i-- + dAtA[i] = 0x2a + } + if len(x.MinUnit) > 0 { + i -= len(x.MinUnit) + copy(dAtA[i:], x.MinUnit) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinUnit))) + i-- + dAtA[i] = 0x22 + } + if x.Scale != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Scale)) + i-- + dAtA[i] = 0x18 + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Symbol) > 0 { + i -= len(x.Symbol) + copy(dAtA[i:], x.Symbol) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Symbol))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventDeployERC20) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventDeployERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventDeployERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Scale", wireType) + } + x.Scale = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Scale |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinUnit", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.MinUnit = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_EventSwapToERC20 protoreflect.MessageDescriptor + fd_EventSwapToERC20_amount protoreflect.FieldDescriptor + fd_EventSwapToERC20_sender protoreflect.FieldDescriptor + fd_EventSwapToERC20_receiver protoreflect.FieldDescriptor + fd_EventSwapToERC20_to_contract protoreflect.FieldDescriptor +) + +func init() { + file_irismod_token_v1_event_proto_init() + md_EventSwapToERC20 = File_irismod_token_v1_event_proto.Messages().ByName("EventSwapToERC20") + fd_EventSwapToERC20_amount = md_EventSwapToERC20.Fields().ByName("amount") + fd_EventSwapToERC20_sender = md_EventSwapToERC20.Fields().ByName("sender") + fd_EventSwapToERC20_receiver = md_EventSwapToERC20.Fields().ByName("receiver") + fd_EventSwapToERC20_to_contract = md_EventSwapToERC20.Fields().ByName("to_contract") +} + +var _ protoreflect.Message = (*fastReflection_EventSwapToERC20)(nil) + +type fastReflection_EventSwapToERC20 EventSwapToERC20 + +func (x *EventSwapToERC20) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventSwapToERC20)(x) +} + +func (x *EventSwapToERC20) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_event_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventSwapToERC20_messageType fastReflection_EventSwapToERC20_messageType +var _ protoreflect.MessageType = fastReflection_EventSwapToERC20_messageType{} + +type fastReflection_EventSwapToERC20_messageType struct{} + +func (x fastReflection_EventSwapToERC20_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventSwapToERC20)(nil) +} +func (x fastReflection_EventSwapToERC20_messageType) New() protoreflect.Message { + return new(fastReflection_EventSwapToERC20) +} +func (x fastReflection_EventSwapToERC20_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventSwapToERC20 +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventSwapToERC20) Descriptor() protoreflect.MessageDescriptor { + return md_EventSwapToERC20 +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventSwapToERC20) Type() protoreflect.MessageType { + return _fastReflection_EventSwapToERC20_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventSwapToERC20) New() protoreflect.Message { + return new(fastReflection_EventSwapToERC20) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventSwapToERC20) Interface() protoreflect.ProtoMessage { + return (*EventSwapToERC20)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventSwapToERC20) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_EventSwapToERC20_amount, value) { + return + } + } + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_EventSwapToERC20_sender, value) { + return + } + } + if x.Receiver != "" { + value := protoreflect.ValueOfString(x.Receiver) + if !f(fd_EventSwapToERC20_receiver, value) { + return + } + } + if x.ToContract != "" { + value := protoreflect.ValueOfString(x.ToContract) + if !f(fd_EventSwapToERC20_to_contract, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventSwapToERC20) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "irismod.token.v1.EventSwapToERC20.amount": + return x.Amount != nil + case "irismod.token.v1.EventSwapToERC20.sender": + return x.Sender != "" + case "irismod.token.v1.EventSwapToERC20.receiver": + return x.Receiver != "" + case "irismod.token.v1.EventSwapToERC20.to_contract": + return x.ToContract != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapToERC20 does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSwapToERC20) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "irismod.token.v1.EventSwapToERC20.amount": + x.Amount = nil + case "irismod.token.v1.EventSwapToERC20.sender": + x.Sender = "" + case "irismod.token.v1.EventSwapToERC20.receiver": + x.Receiver = "" + case "irismod.token.v1.EventSwapToERC20.to_contract": + x.ToContract = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapToERC20 does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventSwapToERC20) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "irismod.token.v1.EventSwapToERC20.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "irismod.token.v1.EventSwapToERC20.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + case "irismod.token.v1.EventSwapToERC20.receiver": + value := x.Receiver + return protoreflect.ValueOfString(value) + case "irismod.token.v1.EventSwapToERC20.to_contract": + value := x.ToContract + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapToERC20 does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSwapToERC20) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "irismod.token.v1.EventSwapToERC20.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) + case "irismod.token.v1.EventSwapToERC20.sender": + x.Sender = value.Interface().(string) + case "irismod.token.v1.EventSwapToERC20.receiver": + x.Receiver = value.Interface().(string) + case "irismod.token.v1.EventSwapToERC20.to_contract": + x.ToContract = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapToERC20 does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSwapToERC20) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.EventSwapToERC20.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + case "irismod.token.v1.EventSwapToERC20.sender": + panic(fmt.Errorf("field sender of message irismod.token.v1.EventSwapToERC20 is not mutable")) + case "irismod.token.v1.EventSwapToERC20.receiver": + panic(fmt.Errorf("field receiver of message irismod.token.v1.EventSwapToERC20 is not mutable")) + case "irismod.token.v1.EventSwapToERC20.to_contract": + panic(fmt.Errorf("field to_contract of message irismod.token.v1.EventSwapToERC20 is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapToERC20 does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventSwapToERC20) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.EventSwapToERC20.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "irismod.token.v1.EventSwapToERC20.sender": + return protoreflect.ValueOfString("") + case "irismod.token.v1.EventSwapToERC20.receiver": + return protoreflect.ValueOfString("") + case "irismod.token.v1.EventSwapToERC20.to_contract": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapToERC20 does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventSwapToERC20) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.EventSwapToERC20", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventSwapToERC20) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSwapToERC20) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventSwapToERC20) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventSwapToERC20) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventSwapToERC20) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Sender) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Receiver) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ToContract) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventSwapToERC20) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.ToContract) > 0 { + i -= len(x.ToContract) + copy(dAtA[i:], x.ToContract) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ToContract))) + i-- + dAtA[i] = 0x22 + } + if len(x.Receiver) > 0 { + i -= len(x.Receiver) + copy(dAtA[i:], x.Receiver) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(x.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + i-- + dAtA[i] = 0x12 + } + if x.Amount != nil { + encoded, err := options.Marshal(x.Amount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventSwapToERC20) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventSwapToERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventSwapToERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ToContract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ToContract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_EventSwapFromERC20 protoreflect.MessageDescriptor + fd_EventSwapFromERC20_wanted_amount protoreflect.FieldDescriptor + fd_EventSwapFromERC20_sender protoreflect.FieldDescriptor + fd_EventSwapFromERC20_receiver protoreflect.FieldDescriptor + fd_EventSwapFromERC20_from_contract protoreflect.FieldDescriptor +) + +func init() { + file_irismod_token_v1_event_proto_init() + md_EventSwapFromERC20 = File_irismod_token_v1_event_proto.Messages().ByName("EventSwapFromERC20") + fd_EventSwapFromERC20_wanted_amount = md_EventSwapFromERC20.Fields().ByName("wanted_amount") + fd_EventSwapFromERC20_sender = md_EventSwapFromERC20.Fields().ByName("sender") + fd_EventSwapFromERC20_receiver = md_EventSwapFromERC20.Fields().ByName("receiver") + fd_EventSwapFromERC20_from_contract = md_EventSwapFromERC20.Fields().ByName("from_contract") +} + +var _ protoreflect.Message = (*fastReflection_EventSwapFromERC20)(nil) + +type fastReflection_EventSwapFromERC20 EventSwapFromERC20 + +func (x *EventSwapFromERC20) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventSwapFromERC20)(x) +} + +func (x *EventSwapFromERC20) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_event_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventSwapFromERC20_messageType fastReflection_EventSwapFromERC20_messageType +var _ protoreflect.MessageType = fastReflection_EventSwapFromERC20_messageType{} + +type fastReflection_EventSwapFromERC20_messageType struct{} + +func (x fastReflection_EventSwapFromERC20_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventSwapFromERC20)(nil) +} +func (x fastReflection_EventSwapFromERC20_messageType) New() protoreflect.Message { + return new(fastReflection_EventSwapFromERC20) +} +func (x fastReflection_EventSwapFromERC20_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventSwapFromERC20 +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventSwapFromERC20) Descriptor() protoreflect.MessageDescriptor { + return md_EventSwapFromERC20 +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventSwapFromERC20) Type() protoreflect.MessageType { + return _fastReflection_EventSwapFromERC20_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventSwapFromERC20) New() protoreflect.Message { + return new(fastReflection_EventSwapFromERC20) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventSwapFromERC20) Interface() protoreflect.ProtoMessage { + return (*EventSwapFromERC20)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventSwapFromERC20) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.WantedAmount != nil { + value := protoreflect.ValueOfMessage(x.WantedAmount.ProtoReflect()) + if !f(fd_EventSwapFromERC20_wanted_amount, value) { + return + } + } + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_EventSwapFromERC20_sender, value) { + return + } + } + if x.Receiver != "" { + value := protoreflect.ValueOfString(x.Receiver) + if !f(fd_EventSwapFromERC20_receiver, value) { + return + } + } + if x.FromContract != "" { + value := protoreflect.ValueOfString(x.FromContract) + if !f(fd_EventSwapFromERC20_from_contract, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventSwapFromERC20) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "irismod.token.v1.EventSwapFromERC20.wanted_amount": + return x.WantedAmount != nil + case "irismod.token.v1.EventSwapFromERC20.sender": + return x.Sender != "" + case "irismod.token.v1.EventSwapFromERC20.receiver": + return x.Receiver != "" + case "irismod.token.v1.EventSwapFromERC20.from_contract": + return x.FromContract != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapFromERC20 does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSwapFromERC20) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "irismod.token.v1.EventSwapFromERC20.wanted_amount": + x.WantedAmount = nil + case "irismod.token.v1.EventSwapFromERC20.sender": + x.Sender = "" + case "irismod.token.v1.EventSwapFromERC20.receiver": + x.Receiver = "" + case "irismod.token.v1.EventSwapFromERC20.from_contract": + x.FromContract = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapFromERC20 does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventSwapFromERC20) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "irismod.token.v1.EventSwapFromERC20.wanted_amount": + value := x.WantedAmount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "irismod.token.v1.EventSwapFromERC20.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + case "irismod.token.v1.EventSwapFromERC20.receiver": + value := x.Receiver + return protoreflect.ValueOfString(value) + case "irismod.token.v1.EventSwapFromERC20.from_contract": + value := x.FromContract + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapFromERC20 does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSwapFromERC20) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "irismod.token.v1.EventSwapFromERC20.wanted_amount": + x.WantedAmount = value.Message().Interface().(*v1beta1.Coin) + case "irismod.token.v1.EventSwapFromERC20.sender": + x.Sender = value.Interface().(string) + case "irismod.token.v1.EventSwapFromERC20.receiver": + x.Receiver = value.Interface().(string) + case "irismod.token.v1.EventSwapFromERC20.from_contract": + x.FromContract = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapFromERC20 does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSwapFromERC20) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.EventSwapFromERC20.wanted_amount": + if x.WantedAmount == nil { + x.WantedAmount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.WantedAmount.ProtoReflect()) + case "irismod.token.v1.EventSwapFromERC20.sender": + panic(fmt.Errorf("field sender of message irismod.token.v1.EventSwapFromERC20 is not mutable")) + case "irismod.token.v1.EventSwapFromERC20.receiver": + panic(fmt.Errorf("field receiver of message irismod.token.v1.EventSwapFromERC20 is not mutable")) + case "irismod.token.v1.EventSwapFromERC20.from_contract": + panic(fmt.Errorf("field from_contract of message irismod.token.v1.EventSwapFromERC20 is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapFromERC20 does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventSwapFromERC20) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.EventSwapFromERC20.wanted_amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "irismod.token.v1.EventSwapFromERC20.sender": + return protoreflect.ValueOfString("") + case "irismod.token.v1.EventSwapFromERC20.receiver": + return protoreflect.ValueOfString("") + case "irismod.token.v1.EventSwapFromERC20.from_contract": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.EventSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.EventSwapFromERC20 does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventSwapFromERC20) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.EventSwapFromERC20", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventSwapFromERC20) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSwapFromERC20) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventSwapFromERC20) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventSwapFromERC20) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventSwapFromERC20) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.WantedAmount != nil { + l = options.Size(x.WantedAmount) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Sender) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Receiver) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.FromContract) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventSwapFromERC20) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.FromContract) > 0 { + i -= len(x.FromContract) + copy(dAtA[i:], x.FromContract) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FromContract))) + i-- + dAtA[i] = 0x22 + } + if len(x.Receiver) > 0 { + i -= len(x.Receiver) + copy(dAtA[i:], x.Receiver) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(x.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + i-- + dAtA[i] = 0x12 + } + if x.WantedAmount != nil { + encoded, err := options.Marshal(x.WantedAmount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventSwapFromERC20) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventSwapFromERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventSwapFromERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WantedAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.WantedAmount == nil { + x.WantedAmount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.WantedAmount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FromContract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.FromContract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: irismod/token/v1/event.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// EventDeployERC20 is an event emitted when deploying ERC20. +type EventDeployERC20 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Scale uint32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"` + MinUnit string `protobuf:"bytes,4,opt,name=min_unit,json=minUnit,proto3" json:"min_unit,omitempty"` + Contract string `protobuf:"bytes,5,opt,name=contract,proto3" json:"contract,omitempty"` +} + +func (x *EventDeployERC20) Reset() { + *x = EventDeployERC20{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_event_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventDeployERC20) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventDeployERC20) ProtoMessage() {} + +// Deprecated: Use EventDeployERC20.ProtoReflect.Descriptor instead. +func (*EventDeployERC20) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_event_proto_rawDescGZIP(), []int{0} +} + +func (x *EventDeployERC20) GetSymbol() string { + if x != nil { + return x.Symbol + } + return "" +} + +func (x *EventDeployERC20) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *EventDeployERC20) GetScale() uint32 { + if x != nil { + return x.Scale + } + return 0 +} + +func (x *EventDeployERC20) GetMinUnit() string { + if x != nil { + return x.MinUnit + } + return "" +} + +func (x *EventDeployERC20) GetContract() string { + if x != nil { + return x.Contract + } + return "" +} + +// EventSwapToERC20 is an event emitted when swapping token from native token to +// ERC20. +type EventSwapToERC20 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Amount *v1beta1.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` + ToContract string `protobuf:"bytes,4,opt,name=to_contract,json=toContract,proto3" json:"to_contract,omitempty"` +} + +func (x *EventSwapToERC20) Reset() { + *x = EventSwapToERC20{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_event_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventSwapToERC20) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventSwapToERC20) ProtoMessage() {} + +// Deprecated: Use EventSwapToERC20.ProtoReflect.Descriptor instead. +func (*EventSwapToERC20) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_event_proto_rawDescGZIP(), []int{1} +} + +func (x *EventSwapToERC20) GetAmount() *v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +func (x *EventSwapToERC20) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +func (x *EventSwapToERC20) GetReceiver() string { + if x != nil { + return x.Receiver + } + return "" +} + +func (x *EventSwapToERC20) GetToContract() string { + if x != nil { + return x.ToContract + } + return "" +} + +// EventSwapFromERC20 is an event emitted when swapping token from ERC20 to +// native token. +type EventSwapFromERC20 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WantedAmount *v1beta1.Coin `protobuf:"bytes,1,opt,name=wanted_amount,json=wantedAmount,proto3" json:"wanted_amount,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` + FromContract string `protobuf:"bytes,4,opt,name=from_contract,json=fromContract,proto3" json:"from_contract,omitempty"` +} + +func (x *EventSwapFromERC20) Reset() { + *x = EventSwapFromERC20{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_event_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventSwapFromERC20) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventSwapFromERC20) ProtoMessage() {} + +// Deprecated: Use EventSwapFromERC20.ProtoReflect.Descriptor instead. +func (*EventSwapFromERC20) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_event_proto_rawDescGZIP(), []int{2} +} + +func (x *EventSwapFromERC20) GetWantedAmount() *v1beta1.Coin { + if x != nil { + return x.WantedAmount + } + return nil +} + +func (x *EventSwapFromERC20) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +func (x *EventSwapFromERC20) GetReceiver() string { + if x != nil { + return x.Receiver + } + return "" +} + +func (x *EventSwapFromERC20) GetFromContract() string { + if x != nil { + return x.FromContract + } + return "" +} + +var File_irismod_token_v1_event_proto protoreflect.FileDescriptor + +var file_irismod_token_v1_event_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, + 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, + 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, + 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, + 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x8b, 0x01, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, + 0x79, 0x45, 0x52, 0x43, 0x32, 0x30, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x69, 0x6e, 0x5f, + 0x75, 0x6e, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x55, + 0x6e, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x22, + 0xba, 0x01, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x77, 0x61, 0x70, 0x54, 0x6f, 0x45, + 0x52, 0x43, 0x32, 0x30, 0x12, 0x37, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, + 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, + 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, + 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, + 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x74, + 0x6f, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x74, 0x6f, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x22, 0xe1, 0x01, 0x0a, + 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x77, 0x61, 0x70, 0x46, 0x72, 0x6f, 0x6d, 0x45, 0x52, + 0x43, 0x32, 0x30, 0x12, 0x3e, 0x0a, 0x0d, 0x77, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0c, 0x77, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x41, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x66, + 0x72, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x42, 0xc1, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, + 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, 0x10, 0x49, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, + 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x1c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x12, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_irismod_token_v1_event_proto_rawDescOnce sync.Once + file_irismod_token_v1_event_proto_rawDescData = file_irismod_token_v1_event_proto_rawDesc +) + +func file_irismod_token_v1_event_proto_rawDescGZIP() []byte { + file_irismod_token_v1_event_proto_rawDescOnce.Do(func() { + file_irismod_token_v1_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_irismod_token_v1_event_proto_rawDescData) + }) + return file_irismod_token_v1_event_proto_rawDescData +} + +var file_irismod_token_v1_event_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_irismod_token_v1_event_proto_goTypes = []interface{}{ + (*EventDeployERC20)(nil), // 0: irismod.token.v1.EventDeployERC20 + (*EventSwapToERC20)(nil), // 1: irismod.token.v1.EventSwapToERC20 + (*EventSwapFromERC20)(nil), // 2: irismod.token.v1.EventSwapFromERC20 + (*v1beta1.Coin)(nil), // 3: cosmos.base.v1beta1.Coin +} +var file_irismod_token_v1_event_proto_depIdxs = []int32{ + 3, // 0: irismod.token.v1.EventSwapToERC20.amount:type_name -> cosmos.base.v1beta1.Coin + 3, // 1: irismod.token.v1.EventSwapFromERC20.wanted_amount:type_name -> cosmos.base.v1beta1.Coin + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_irismod_token_v1_event_proto_init() } +func file_irismod_token_v1_event_proto_init() { + if File_irismod_token_v1_event_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_irismod_token_v1_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventDeployERC20); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_irismod_token_v1_event_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventSwapToERC20); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_irismod_token_v1_event_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventSwapFromERC20); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_irismod_token_v1_event_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_irismod_token_v1_event_proto_goTypes, + DependencyIndexes: file_irismod_token_v1_event_proto_depIdxs, + MessageInfos: file_irismod_token_v1_event_proto_msgTypes, + }.Build() + File_irismod_token_v1_event_proto = out.File + file_irismod_token_v1_event_proto_rawDesc = nil + file_irismod_token_v1_event_proto_goTypes = nil + file_irismod_token_v1_event_proto_depIdxs = nil +} diff --git a/api/irismod/token/v1/query.pulsar.go b/api/irismod/token/v1/query.pulsar.go index df0aa040..e08b51c3 100644 --- a/api/irismod/token/v1/query.pulsar.go +++ b/api/irismod/token/v1/query.pulsar.go @@ -2,6 +2,7 @@ package tokenv1 import ( + _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" v1beta11 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/query/v1" @@ -4654,6 +4655,984 @@ func (x *fastReflection_QueryTotalBurnResponse) ProtoMethods() *protoiface.Metho } } +var ( + md_QueryBalancesRequest protoreflect.MessageDescriptor + fd_QueryBalancesRequest_denom protoreflect.FieldDescriptor + fd_QueryBalancesRequest_address protoreflect.FieldDescriptor +) + +func init() { + file_irismod_token_v1_query_proto_init() + md_QueryBalancesRequest = File_irismod_token_v1_query_proto.Messages().ByName("QueryBalancesRequest") + fd_QueryBalancesRequest_denom = md_QueryBalancesRequest.Fields().ByName("denom") + fd_QueryBalancesRequest_address = md_QueryBalancesRequest.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_QueryBalancesRequest)(nil) + +type fastReflection_QueryBalancesRequest QueryBalancesRequest + +func (x *QueryBalancesRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryBalancesRequest)(x) +} + +func (x *QueryBalancesRequest) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_query_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryBalancesRequest_messageType fastReflection_QueryBalancesRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryBalancesRequest_messageType{} + +type fastReflection_QueryBalancesRequest_messageType struct{} + +func (x fastReflection_QueryBalancesRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryBalancesRequest)(nil) +} +func (x fastReflection_QueryBalancesRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryBalancesRequest) +} +func (x fastReflection_QueryBalancesRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryBalancesRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryBalancesRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryBalancesRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryBalancesRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryBalancesRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryBalancesRequest) New() protoreflect.Message { + return new(fastReflection_QueryBalancesRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryBalancesRequest) Interface() protoreflect.ProtoMessage { + return (*QueryBalancesRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryBalancesRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Denom != "" { + value := protoreflect.ValueOfString(x.Denom) + if !f(fd_QueryBalancesRequest_denom, value) { + return + } + } + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_QueryBalancesRequest_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryBalancesRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "irismod.token.v1.QueryBalancesRequest.denom": + return x.Denom != "" + case "irismod.token.v1.QueryBalancesRequest.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesRequest")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryBalancesRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "irismod.token.v1.QueryBalancesRequest.denom": + x.Denom = "" + case "irismod.token.v1.QueryBalancesRequest.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesRequest")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryBalancesRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "irismod.token.v1.QueryBalancesRequest.denom": + value := x.Denom + return protoreflect.ValueOfString(value) + case "irismod.token.v1.QueryBalancesRequest.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesRequest")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryBalancesRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "irismod.token.v1.QueryBalancesRequest.denom": + x.Denom = value.Interface().(string) + case "irismod.token.v1.QueryBalancesRequest.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesRequest")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryBalancesRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.QueryBalancesRequest.denom": + panic(fmt.Errorf("field denom of message irismod.token.v1.QueryBalancesRequest is not mutable")) + case "irismod.token.v1.QueryBalancesRequest.address": + panic(fmt.Errorf("field address of message irismod.token.v1.QueryBalancesRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesRequest")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryBalancesRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.QueryBalancesRequest.denom": + return protoreflect.ValueOfString("") + case "irismod.token.v1.QueryBalancesRequest.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesRequest")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryBalancesRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.QueryBalancesRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryBalancesRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryBalancesRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryBalancesRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryBalancesRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryBalancesRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Denom) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryBalancesRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0x12 + } + if len(x.Denom) > 0 { + i -= len(x.Denom) + copy(dAtA[i:], x.Denom) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Denom))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryBalancesRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryBalancesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryBalancesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryBalancesResponse_1_list)(nil) + +type _QueryBalancesResponse_1_list struct { + list *[]*v1beta11.Coin +} + +func (x *_QueryBalancesResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryBalancesResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryBalancesResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta11.Coin) + (*x.list)[i] = concreteValue +} + +func (x *_QueryBalancesResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta11.Coin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryBalancesResponse_1_list) AppendMutable() protoreflect.Value { + v := new(v1beta11.Coin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryBalancesResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryBalancesResponse_1_list) NewElement() protoreflect.Value { + v := new(v1beta11.Coin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryBalancesResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryBalancesResponse protoreflect.MessageDescriptor + fd_QueryBalancesResponse_balances protoreflect.FieldDescriptor +) + +func init() { + file_irismod_token_v1_query_proto_init() + md_QueryBalancesResponse = File_irismod_token_v1_query_proto.Messages().ByName("QueryBalancesResponse") + fd_QueryBalancesResponse_balances = md_QueryBalancesResponse.Fields().ByName("balances") +} + +var _ protoreflect.Message = (*fastReflection_QueryBalancesResponse)(nil) + +type fastReflection_QueryBalancesResponse QueryBalancesResponse + +func (x *QueryBalancesResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryBalancesResponse)(x) +} + +func (x *QueryBalancesResponse) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_query_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryBalancesResponse_messageType fastReflection_QueryBalancesResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryBalancesResponse_messageType{} + +type fastReflection_QueryBalancesResponse_messageType struct{} + +func (x fastReflection_QueryBalancesResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryBalancesResponse)(nil) +} +func (x fastReflection_QueryBalancesResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryBalancesResponse) +} +func (x fastReflection_QueryBalancesResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryBalancesResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryBalancesResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryBalancesResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryBalancesResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryBalancesResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryBalancesResponse) New() protoreflect.Message { + return new(fastReflection_QueryBalancesResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryBalancesResponse) Interface() protoreflect.ProtoMessage { + return (*QueryBalancesResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryBalancesResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Balances) != 0 { + value := protoreflect.ValueOfList(&_QueryBalancesResponse_1_list{list: &x.Balances}) + if !f(fd_QueryBalancesResponse_balances, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryBalancesResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "irismod.token.v1.QueryBalancesResponse.balances": + return len(x.Balances) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesResponse")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryBalancesResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "irismod.token.v1.QueryBalancesResponse.balances": + x.Balances = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesResponse")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryBalancesResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "irismod.token.v1.QueryBalancesResponse.balances": + if len(x.Balances) == 0 { + return protoreflect.ValueOfList(&_QueryBalancesResponse_1_list{}) + } + listValue := &_QueryBalancesResponse_1_list{list: &x.Balances} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesResponse")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryBalancesResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "irismod.token.v1.QueryBalancesResponse.balances": + lv := value.List() + clv := lv.(*_QueryBalancesResponse_1_list) + x.Balances = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesResponse")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryBalancesResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.QueryBalancesResponse.balances": + if x.Balances == nil { + x.Balances = []*v1beta11.Coin{} + } + value := &_QueryBalancesResponse_1_list{list: &x.Balances} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesResponse")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryBalancesResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.QueryBalancesResponse.balances": + list := []*v1beta11.Coin{} + return protoreflect.ValueOfList(&_QueryBalancesResponse_1_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.QueryBalancesResponse")) + } + panic(fmt.Errorf("message irismod.token.v1.QueryBalancesResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryBalancesResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.QueryBalancesResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryBalancesResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryBalancesResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryBalancesResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryBalancesResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryBalancesResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Balances) > 0 { + for _, e := range x.Balances { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryBalancesResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Balances) > 0 { + for iNdEx := len(x.Balances) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Balances[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryBalancesResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryBalancesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryBalancesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Balances", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Balances = append(x.Balances, &v1beta11.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Balances[len(x.Balances)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -5050,6 +6029,88 @@ func (x *QueryTotalBurnResponse) GetBurnedCoins() []*v1beta11.Coin { return nil } +// QueryBalancesRequest is request type for the Query/Balances RPC method +type QueryBalancesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // address is the address to query balances for. + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *QueryBalancesRequest) Reset() { + *x = QueryBalancesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_query_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryBalancesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryBalancesRequest) ProtoMessage() {} + +// Deprecated: Use QueryBalancesRequest.ProtoReflect.Descriptor instead. +func (*QueryBalancesRequest) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_query_proto_rawDescGZIP(), []int{10} +} + +func (x *QueryBalancesRequest) GetDenom() string { + if x != nil { + return x.Denom + } + return "" +} + +func (x *QueryBalancesRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +// QueryBalancesResponse is response type for the Query/Balances RPC method +type QueryBalancesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // balances is the balances of all the coins. + Balances []*v1beta11.Coin `protobuf:"bytes,1,rep,name=balances,proto3" json:"balances,omitempty"` +} + +func (x *QueryBalancesResponse) Reset() { + *x = QueryBalancesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_query_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryBalancesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryBalancesResponse) ProtoMessage() {} + +// Deprecated: Use QueryBalancesResponse.ProtoReflect.Descriptor instead. +func (*QueryBalancesResponse) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_query_proto_rawDescGZIP(), []int{11} +} + +func (x *QueryBalancesResponse) GetBalances() []*v1beta11.Coin { + if x != nil { + return x.Balances + } + return nil +} + var File_irismod_token_v1_query_proto protoreflect.FileDescriptor var file_irismod_token_v1_query_proto_rawDesc = []byte{ @@ -5069,86 +6130,102 @@ var file_irismod_token_v1_query_proto_rawDesc = []byte{ 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x29, 0x0a, 0x11, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x4e, 0x0a, 0x12, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x0c, 0xca, 0xb4, 0x2d, 0x08, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x49, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x72, 0x0a, 0x12, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, - 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x9a, 0x01, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x0c, - 0xca, 0xb4, 0x2d, 0x08, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, 0x52, 0x06, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2a, 0x0a, - 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x65, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x22, 0xf9, 0x01, 0x0a, 0x11, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x46, 0x65, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x65, 0x78, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, - 0x65, 0x78, 0x69, 0x73, 0x74, 0x12, 0x67, 0x0a, 0x09, 0x69, 0x73, 0x73, 0x75, 0x65, 0x5f, 0x66, - 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, - 0x6f, 0x69, 0x6e, 0x42, 0x2f, 0xc8, 0xde, 0x1f, 0x00, 0xfa, 0xde, 0x1f, 0x27, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x08, 0x69, 0x73, 0x73, 0x75, 0x65, 0x46, 0x65, 0x65, 0x12, 0x65, - 0x0a, 0x08, 0x6d, 0x69, 0x6e, 0x74, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x2f, 0xc8, 0xde, 0x1f, - 0x00, 0xfa, 0xde, 0x1f, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, - 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x07, 0x6d, 0x69, - 0x6e, 0x74, 0x46, 0x65, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x88, 0x01, 0x0a, 0x13, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, - 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x39, 0x0a, 0x03, 0x72, - 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x52, 0x03, 0x72, 0x65, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, - 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, - 0x5c, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x75, 0x72, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0c, 0x62, 0x75, 0x72, - 0x6e, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, - 0x52, 0x0b, 0x62, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x32, 0x9a, 0x05, - 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x81, 0x01, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x12, 0x23, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, + 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x29, 0x0a, 0x11, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, + 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x22, + 0x4e, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x0c, 0xca, 0xb4, 0x2d, 0x08, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0x72, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x9a, 0x01, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x06, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, + 0x79, 0x42, 0x0c, 0xca, 0xb4, 0x2d, 0x08, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, 0x52, + 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x22, 0x2a, 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x65, 0x65, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x22, 0xf9, 0x01, 0x0a, + 0x11, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x65, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x05, 0x65, 0x78, 0x69, 0x73, 0x74, 0x12, 0x67, 0x0a, 0x09, 0x69, 0x73, 0x73, 0x75, + 0x65, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x2f, 0xc8, 0xde, 0x1f, 0x00, 0xfa, 0xde, 0x1f, 0x27, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x08, 0x69, 0x73, 0x73, 0x75, 0x65, 0x46, 0x65, + 0x65, 0x12, 0x65, 0x0a, 0x08, 0x6d, 0x69, 0x6e, 0x74, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x2f, + 0xc8, 0xde, 0x1f, 0x00, 0xfa, 0xde, 0x1f, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, + 0x07, 0x6d, 0x69, 0x6e, 0x74, 0x46, 0x65, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x88, + 0x01, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x39, + 0x0a, 0x03, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x03, 0x72, 0x65, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x5c, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x74, 0x61, 0x6c, + 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0c, + 0x62, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, + 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x62, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x69, 0x6e, 0x73, + 0x22, 0x60, 0x0a, 0x14, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x32, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x22, 0x85, 0x01, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x6c, 0x61, + 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6c, 0x0a, 0x08, + 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x35, 0xc8, 0xde, 0x1f, 0x00, 0xaa, + 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, + 0x52, 0x08, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x32, 0xb9, 0x06, 0x0a, 0x05, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x12, 0x7c, 0x0a, 0x06, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x24, + 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x88, 0xe7, 0xb0, + 0x2a, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, + 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x73, 0x12, 0x84, 0x01, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x2e, 0x69, + 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x24, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x88, 0xe7, - 0xb0, 0x2a, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x69, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x73, 0x2f, 0x7b, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x7d, 0x12, 0x7c, 0x0a, 0x06, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x24, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x69, 0x72, - 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x25, 0x88, 0xe7, 0xb0, 0x2a, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, - 0x18, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, - 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x84, 0x01, 0x0a, 0x04, 0x46, 0x65, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x88, 0xe7, 0xb0, 0x2a, 0x01, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x2f, 0x7b, + 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x3d, 0x2a, 0x2a, 0x7d, 0x12, 0x84, 0x01, 0x0a, 0x04, 0x46, 0x65, 0x65, 0x73, 0x12, 0x22, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x65, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, @@ -5173,20 +6250,29 @@ var file_irismod_token_v1_query_proto_rawDesc = []byte{ 0x74, 0x61, 0x6c, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x88, 0xe7, 0xb0, 0x2a, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x2f, - 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x42, 0xbd, 0x01, 0x0a, 0x14, 0x63, - 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, - 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, - 0x76, 0x31, 0x3b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x54, 0x58, - 0xaa, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, - 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x12, 0x99, 0x01, 0x0a, 0x08, 0x42, + 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x26, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x27, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3c, 0x88, 0xe7, 0xb0, 0x2a, 0x01, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x31, 0x12, 0x2f, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, + 0x73, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x2f, 0x7b, 0x64, 0x65, 0x6e, + 0x6f, 0x6d, 0x3d, 0x2a, 0x2a, 0x7d, 0x42, 0xbd, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x69, + 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x42, + 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, + 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, 0x10, 0x49, + 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x56, 0x31, 0xca, + 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x12, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -5201,7 +6287,7 @@ func file_irismod_token_v1_query_proto_rawDescGZIP() []byte { return file_irismod_token_v1_query_proto_rawDescData } -var file_irismod_token_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_irismod_token_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_irismod_token_v1_query_proto_goTypes = []interface{}{ (*QueryTokenRequest)(nil), // 0: irismod.token.v1.QueryTokenRequest (*QueryTokenResponse)(nil), // 1: irismod.token.v1.QueryTokenResponse @@ -5213,37 +6299,42 @@ var file_irismod_token_v1_query_proto_goTypes = []interface{}{ (*QueryParamsResponse)(nil), // 7: irismod.token.v1.QueryParamsResponse (*QueryTotalBurnRequest)(nil), // 8: irismod.token.v1.QueryTotalBurnRequest (*QueryTotalBurnResponse)(nil), // 9: irismod.token.v1.QueryTotalBurnResponse - (*anypb.Any)(nil), // 10: google.protobuf.Any - (*v1beta1.PageRequest)(nil), // 11: cosmos.base.query.v1beta1.PageRequest - (*v1beta1.PageResponse)(nil), // 12: cosmos.base.query.v1beta1.PageResponse - (*v1beta11.Coin)(nil), // 13: cosmos.base.v1beta1.Coin - (*Params)(nil), // 14: irismod.token.v1.Params + (*QueryBalancesRequest)(nil), // 10: irismod.token.v1.QueryBalancesRequest + (*QueryBalancesResponse)(nil), // 11: irismod.token.v1.QueryBalancesResponse + (*anypb.Any)(nil), // 12: google.protobuf.Any + (*v1beta1.PageRequest)(nil), // 13: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 14: cosmos.base.query.v1beta1.PageResponse + (*v1beta11.Coin)(nil), // 15: cosmos.base.v1beta1.Coin + (*Params)(nil), // 16: irismod.token.v1.Params } var file_irismod_token_v1_query_proto_depIdxs = []int32{ - 10, // 0: irismod.token.v1.QueryTokenResponse.token:type_name -> google.protobuf.Any - 11, // 1: irismod.token.v1.QueryTokensRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 10, // 2: irismod.token.v1.QueryTokensResponse.tokens:type_name -> google.protobuf.Any - 12, // 3: irismod.token.v1.QueryTokensResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse - 13, // 4: irismod.token.v1.QueryFeesResponse.issue_fee:type_name -> cosmos.base.v1beta1.Coin - 13, // 5: irismod.token.v1.QueryFeesResponse.mint_fee:type_name -> cosmos.base.v1beta1.Coin - 14, // 6: irismod.token.v1.QueryParamsResponse.params:type_name -> irismod.token.v1.Params - 12, // 7: irismod.token.v1.QueryParamsResponse.res:type_name -> cosmos.base.query.v1beta1.PageResponse - 13, // 8: irismod.token.v1.QueryTotalBurnResponse.burned_coins:type_name -> cosmos.base.v1beta1.Coin - 0, // 9: irismod.token.v1.Query.Token:input_type -> irismod.token.v1.QueryTokenRequest + 12, // 0: irismod.token.v1.QueryTokenResponse.token:type_name -> google.protobuf.Any + 13, // 1: irismod.token.v1.QueryTokensRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 12, // 2: irismod.token.v1.QueryTokensResponse.tokens:type_name -> google.protobuf.Any + 14, // 3: irismod.token.v1.QueryTokensResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 15, // 4: irismod.token.v1.QueryFeesResponse.issue_fee:type_name -> cosmos.base.v1beta1.Coin + 15, // 5: irismod.token.v1.QueryFeesResponse.mint_fee:type_name -> cosmos.base.v1beta1.Coin + 16, // 6: irismod.token.v1.QueryParamsResponse.params:type_name -> irismod.token.v1.Params + 14, // 7: irismod.token.v1.QueryParamsResponse.res:type_name -> cosmos.base.query.v1beta1.PageResponse + 15, // 8: irismod.token.v1.QueryTotalBurnResponse.burned_coins:type_name -> cosmos.base.v1beta1.Coin + 15, // 9: irismod.token.v1.QueryBalancesResponse.balances:type_name -> cosmos.base.v1beta1.Coin 2, // 10: irismod.token.v1.Query.Tokens:input_type -> irismod.token.v1.QueryTokensRequest - 4, // 11: irismod.token.v1.Query.Fees:input_type -> irismod.token.v1.QueryFeesRequest - 6, // 12: irismod.token.v1.Query.Params:input_type -> irismod.token.v1.QueryParamsRequest - 8, // 13: irismod.token.v1.Query.TotalBurn:input_type -> irismod.token.v1.QueryTotalBurnRequest - 1, // 14: irismod.token.v1.Query.Token:output_type -> irismod.token.v1.QueryTokenResponse - 3, // 15: irismod.token.v1.Query.Tokens:output_type -> irismod.token.v1.QueryTokensResponse - 5, // 16: irismod.token.v1.Query.Fees:output_type -> irismod.token.v1.QueryFeesResponse - 7, // 17: irismod.token.v1.Query.Params:output_type -> irismod.token.v1.QueryParamsResponse - 9, // 18: irismod.token.v1.Query.TotalBurn:output_type -> irismod.token.v1.QueryTotalBurnResponse - 14, // [14:19] is the sub-list for method output_type - 9, // [9:14] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 0, // 11: irismod.token.v1.Query.Token:input_type -> irismod.token.v1.QueryTokenRequest + 4, // 12: irismod.token.v1.Query.Fees:input_type -> irismod.token.v1.QueryFeesRequest + 6, // 13: irismod.token.v1.Query.Params:input_type -> irismod.token.v1.QueryParamsRequest + 8, // 14: irismod.token.v1.Query.TotalBurn:input_type -> irismod.token.v1.QueryTotalBurnRequest + 10, // 15: irismod.token.v1.Query.Balances:input_type -> irismod.token.v1.QueryBalancesRequest + 3, // 16: irismod.token.v1.Query.Tokens:output_type -> irismod.token.v1.QueryTokensResponse + 1, // 17: irismod.token.v1.Query.Token:output_type -> irismod.token.v1.QueryTokenResponse + 5, // 18: irismod.token.v1.Query.Fees:output_type -> irismod.token.v1.QueryFeesResponse + 7, // 19: irismod.token.v1.Query.Params:output_type -> irismod.token.v1.QueryParamsResponse + 9, // 20: irismod.token.v1.Query.TotalBurn:output_type -> irismod.token.v1.QueryTotalBurnResponse + 11, // 21: irismod.token.v1.Query.Balances:output_type -> irismod.token.v1.QueryBalancesResponse + 16, // [16:22] is the sub-list for method output_type + 10, // [10:16] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_irismod_token_v1_query_proto_init() } @@ -5373,6 +6464,30 @@ func file_irismod_token_v1_query_proto_init() { return nil } } + file_irismod_token_v1_query_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryBalancesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_irismod_token_v1_query_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryBalancesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -5380,7 +6495,7 @@ func file_irismod_token_v1_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_irismod_token_v1_query_proto_rawDesc, NumEnums: 0, - NumMessages: 10, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/api/irismod/token/v1/query_grpc.pb.go b/api/irismod/token/v1/query_grpc.pb.go index 166e4c05..634dc66a 100644 --- a/api/irismod/token/v1/query_grpc.pb.go +++ b/api/irismod/token/v1/query_grpc.pb.go @@ -19,27 +19,31 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Query_Token_FullMethodName = "/irismod.token.v1.Query/Token" Query_Tokens_FullMethodName = "/irismod.token.v1.Query/Tokens" + Query_Token_FullMethodName = "/irismod.token.v1.Query/Token" Query_Fees_FullMethodName = "/irismod.token.v1.Query/Fees" Query_Params_FullMethodName = "/irismod.token.v1.Query/Params" Query_TotalBurn_FullMethodName = "/irismod.token.v1.Query/TotalBurn" + Query_Balances_FullMethodName = "/irismod.token.v1.Query/Balances" ) // QueryClient is the client API for Query service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type QueryClient interface { - // Token returns token with token name - Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) // Tokens returns the token list Tokens(ctx context.Context, in *QueryTokensRequest, opts ...grpc.CallOption) (*QueryTokensResponse, error) + // Token returns token with token name + Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) // Fees returns the fees to issue or mint a token Fees(ctx context.Context, in *QueryFeesRequest, opts ...grpc.CallOption) (*QueryFeesResponse, error) // Params queries the token parameters Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // TotalBurn queries all the burnt coins TotalBurn(ctx context.Context, in *QueryTotalBurnRequest, opts ...grpc.CallOption) (*QueryTotalBurnResponse, error) + // Balances queries the balance of the specified token (including erc20 + // balance) + Balances(ctx context.Context, in *QueryBalancesRequest, opts ...grpc.CallOption) (*QueryBalancesResponse, error) } type queryClient struct { @@ -50,18 +54,18 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { return &queryClient{cc} } -func (c *queryClient) Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) { - out := new(QueryTokenResponse) - err := c.cc.Invoke(ctx, Query_Token_FullMethodName, in, out, opts...) +func (c *queryClient) Tokens(ctx context.Context, in *QueryTokensRequest, opts ...grpc.CallOption) (*QueryTokensResponse, error) { + out := new(QueryTokensResponse) + err := c.cc.Invoke(ctx, Query_Tokens_FullMethodName, in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) Tokens(ctx context.Context, in *QueryTokensRequest, opts ...grpc.CallOption) (*QueryTokensResponse, error) { - out := new(QueryTokensResponse) - err := c.cc.Invoke(ctx, Query_Tokens_FullMethodName, in, out, opts...) +func (c *queryClient) Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) { + out := new(QueryTokenResponse) + err := c.cc.Invoke(ctx, Query_Token_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -95,20 +99,32 @@ func (c *queryClient) TotalBurn(ctx context.Context, in *QueryTotalBurnRequest, return out, nil } +func (c *queryClient) Balances(ctx context.Context, in *QueryBalancesRequest, opts ...grpc.CallOption) (*QueryBalancesResponse, error) { + out := new(QueryBalancesResponse) + err := c.cc.Invoke(ctx, Query_Balances_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer // for forward compatibility type QueryServer interface { - // Token returns token with token name - Token(context.Context, *QueryTokenRequest) (*QueryTokenResponse, error) // Tokens returns the token list Tokens(context.Context, *QueryTokensRequest) (*QueryTokensResponse, error) + // Token returns token with token name + Token(context.Context, *QueryTokenRequest) (*QueryTokenResponse, error) // Fees returns the fees to issue or mint a token Fees(context.Context, *QueryFeesRequest) (*QueryFeesResponse, error) // Params queries the token parameters Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // TotalBurn queries all the burnt coins TotalBurn(context.Context, *QueryTotalBurnRequest) (*QueryTotalBurnResponse, error) + // Balances queries the balance of the specified token (including erc20 + // balance) + Balances(context.Context, *QueryBalancesRequest) (*QueryBalancesResponse, error) mustEmbedUnimplementedQueryServer() } @@ -116,12 +132,12 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (UnimplementedQueryServer) Token(context.Context, *QueryTokenRequest) (*QueryTokenResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Token not implemented") -} func (UnimplementedQueryServer) Tokens(context.Context, *QueryTokensRequest) (*QueryTokensResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Tokens not implemented") } +func (UnimplementedQueryServer) Token(context.Context, *QueryTokenRequest) (*QueryTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Token not implemented") +} func (UnimplementedQueryServer) Fees(context.Context, *QueryFeesRequest) (*QueryFeesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Fees not implemented") } @@ -131,6 +147,9 @@ func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*Q func (UnimplementedQueryServer) TotalBurn(context.Context, *QueryTotalBurnRequest) (*QueryTotalBurnResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TotalBurn not implemented") } +func (UnimplementedQueryServer) Balances(context.Context, *QueryBalancesRequest) (*QueryBalancesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Balances not implemented") +} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. @@ -144,38 +163,38 @@ func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { s.RegisterService(&Query_ServiceDesc, srv) } -func _Query_Token_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTokenRequest) +func _Query_Tokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokensRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Token(ctx, in) + return srv.(QueryServer).Tokens(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Query_Token_FullMethodName, + FullMethod: Query_Tokens_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Token(ctx, req.(*QueryTokenRequest)) + return srv.(QueryServer).Tokens(ctx, req.(*QueryTokensRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_Tokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTokensRequest) +func _Query_Token_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Tokens(ctx, in) + return srv.(QueryServer).Token(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Query_Tokens_FullMethodName, + FullMethod: Query_Token_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Tokens(ctx, req.(*QueryTokensRequest)) + return srv.(QueryServer).Token(ctx, req.(*QueryTokenRequest)) } return interceptor(ctx, in, info, handler) } @@ -234,6 +253,24 @@ func _Query_TotalBurn_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Query_Balances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBalancesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Balances(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_Balances_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Balances(ctx, req.(*QueryBalancesRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Query_ServiceDesc is the grpc.ServiceDesc for Query service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -241,14 +278,14 @@ var Query_ServiceDesc = grpc.ServiceDesc{ ServiceName: "irismod.token.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Token", - Handler: _Query_Token_Handler, - }, { MethodName: "Tokens", Handler: _Query_Tokens_Handler, }, + { + MethodName: "Token", + Handler: _Query_Token_Handler, + }, { MethodName: "Fees", Handler: _Query_Fees_Handler, @@ -261,6 +298,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "TotalBurn", Handler: _Query_TotalBurn_Handler, }, + { + MethodName: "Balances", + Handler: _Query_Balances_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "irismod/token/v1/query.proto", diff --git a/api/irismod/token/v1/token.pulsar.go b/api/irismod/token/v1/token.pulsar.go index b656da07..e945319c 100644 --- a/api/irismod/token/v1/token.pulsar.go +++ b/api/irismod/token/v1/token.pulsar.go @@ -24,6 +24,7 @@ var ( fd_Token_max_supply protoreflect.FieldDescriptor fd_Token_mintable protoreflect.FieldDescriptor fd_Token_owner protoreflect.FieldDescriptor + fd_Token_contract protoreflect.FieldDescriptor ) func init() { @@ -37,6 +38,7 @@ func init() { fd_Token_max_supply = md_Token.Fields().ByName("max_supply") fd_Token_mintable = md_Token.Fields().ByName("mintable") fd_Token_owner = md_Token.Fields().ByName("owner") + fd_Token_contract = md_Token.Fields().ByName("contract") } var _ protoreflect.Message = (*fastReflection_Token)(nil) @@ -152,6 +154,12 @@ func (x *fastReflection_Token) Range(f func(protoreflect.FieldDescriptor, protor return } } + if x.Contract != "" { + value := protoreflect.ValueOfString(x.Contract) + if !f(fd_Token_contract, value) { + return + } + } } // Has reports whether a field is populated. @@ -183,6 +191,8 @@ func (x *fastReflection_Token) Has(fd protoreflect.FieldDescriptor) bool { return x.Mintable != false case "irismod.token.v1.Token.owner": return x.Owner != "" + case "irismod.token.v1.Token.contract": + return x.Contract != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Token")) @@ -215,6 +225,8 @@ func (x *fastReflection_Token) Clear(fd protoreflect.FieldDescriptor) { x.Mintable = false case "irismod.token.v1.Token.owner": x.Owner = "" + case "irismod.token.v1.Token.contract": + x.Contract = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Token")) @@ -255,6 +267,9 @@ func (x *fastReflection_Token) Get(descriptor protoreflect.FieldDescriptor) prot case "irismod.token.v1.Token.owner": value := x.Owner return protoreflect.ValueOfString(value) + case "irismod.token.v1.Token.contract": + value := x.Contract + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Token")) @@ -291,6 +306,8 @@ func (x *fastReflection_Token) Set(fd protoreflect.FieldDescriptor, value protor x.Mintable = value.Bool() case "irismod.token.v1.Token.owner": x.Owner = value.Interface().(string) + case "irismod.token.v1.Token.contract": + x.Contract = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Token")) @@ -327,6 +344,8 @@ func (x *fastReflection_Token) Mutable(fd protoreflect.FieldDescriptor) protoref panic(fmt.Errorf("field mintable of message irismod.token.v1.Token is not mutable")) case "irismod.token.v1.Token.owner": panic(fmt.Errorf("field owner of message irismod.token.v1.Token is not mutable")) + case "irismod.token.v1.Token.contract": + panic(fmt.Errorf("field contract of message irismod.token.v1.Token is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Token")) @@ -356,6 +375,8 @@ func (x *fastReflection_Token) NewField(fd protoreflect.FieldDescriptor) protore return protoreflect.ValueOfBool(false) case "irismod.token.v1.Token.owner": return protoreflect.ValueOfString("") + case "irismod.token.v1.Token.contract": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Token")) @@ -453,6 +474,10 @@ func (x *fastReflection_Token) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.Contract) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -482,6 +507,13 @@ func (x *fastReflection_Token) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Contract) > 0 { + i -= len(x.Contract) + copy(dAtA[i:], x.Contract) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Contract))) + i-- + dAtA[i] = 0x4a + } if len(x.Owner) > 0 { i -= len(x.Owner) copy(dAtA[i:], x.Owner) @@ -789,6 +821,38 @@ func (x *fastReflection_Token) ProtoMethods() *protoiface.Methods { } x.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 9: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -829,6 +893,8 @@ var ( fd_Params_token_tax_rate protoreflect.FieldDescriptor fd_Params_issue_token_base_fee protoreflect.FieldDescriptor fd_Params_mint_token_fee_ratio protoreflect.FieldDescriptor + fd_Params_enable_erc20 protoreflect.FieldDescriptor + fd_Params_beacon protoreflect.FieldDescriptor ) func init() { @@ -837,6 +903,8 @@ func init() { fd_Params_token_tax_rate = md_Params.Fields().ByName("token_tax_rate") fd_Params_issue_token_base_fee = md_Params.Fields().ByName("issue_token_base_fee") fd_Params_mint_token_fee_ratio = md_Params.Fields().ByName("mint_token_fee_ratio") + fd_Params_enable_erc20 = md_Params.Fields().ByName("enable_erc20") + fd_Params_beacon = md_Params.Fields().ByName("beacon") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -922,6 +990,18 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto return } } + if x.EnableErc20 != false { + value := protoreflect.ValueOfBool(x.EnableErc20) + if !f(fd_Params_enable_erc20, value) { + return + } + } + if x.Beacon != "" { + value := protoreflect.ValueOfString(x.Beacon) + if !f(fd_Params_beacon, value) { + return + } + } } // Has reports whether a field is populated. @@ -943,6 +1023,10 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { return x.IssueTokenBaseFee != nil case "irismod.token.v1.Params.mint_token_fee_ratio": return x.MintTokenFeeRatio != "" + case "irismod.token.v1.Params.enable_erc20": + return x.EnableErc20 != false + case "irismod.token.v1.Params.beacon": + return x.Beacon != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -965,6 +1049,10 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { x.IssueTokenBaseFee = nil case "irismod.token.v1.Params.mint_token_fee_ratio": x.MintTokenFeeRatio = "" + case "irismod.token.v1.Params.enable_erc20": + x.EnableErc20 = false + case "irismod.token.v1.Params.beacon": + x.Beacon = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -990,6 +1078,12 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro case "irismod.token.v1.Params.mint_token_fee_ratio": value := x.MintTokenFeeRatio return protoreflect.ValueOfString(value) + case "irismod.token.v1.Params.enable_erc20": + value := x.EnableErc20 + return protoreflect.ValueOfBool(value) + case "irismod.token.v1.Params.beacon": + value := x.Beacon + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -1016,6 +1110,10 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto x.IssueTokenBaseFee = value.Message().Interface().(*v1beta1.Coin) case "irismod.token.v1.Params.mint_token_fee_ratio": x.MintTokenFeeRatio = value.Interface().(string) + case "irismod.token.v1.Params.enable_erc20": + x.EnableErc20 = value.Bool() + case "irismod.token.v1.Params.beacon": + x.Beacon = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -1045,6 +1143,10 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore panic(fmt.Errorf("field token_tax_rate of message irismod.token.v1.Params is not mutable")) case "irismod.token.v1.Params.mint_token_fee_ratio": panic(fmt.Errorf("field mint_token_fee_ratio of message irismod.token.v1.Params is not mutable")) + case "irismod.token.v1.Params.enable_erc20": + panic(fmt.Errorf("field enable_erc20 of message irismod.token.v1.Params is not mutable")) + case "irismod.token.v1.Params.beacon": + panic(fmt.Errorf("field beacon of message irismod.token.v1.Params is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -1065,6 +1167,10 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor return protoreflect.ValueOfMessage(m.ProtoReflect()) case "irismod.token.v1.Params.mint_token_fee_ratio": return protoreflect.ValueOfString("") + case "irismod.token.v1.Params.enable_erc20": + return protoreflect.ValueOfBool(false) + case "irismod.token.v1.Params.beacon": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -1146,6 +1252,13 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.EnableErc20 { + n += 2 + } + l = len(x.Beacon) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1175,6 +1288,23 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Beacon) > 0 { + i -= len(x.Beacon) + copy(dAtA[i:], x.Beacon) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Beacon))) + i-- + dAtA[i] = 0x2a + } + if x.EnableErc20 { + i-- + if x.EnableErc20 { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if len(x.MintTokenFeeRatio) > 0 { i -= len(x.MintTokenFeeRatio) copy(dAtA[i:], x.MintTokenFeeRatio) @@ -1352,6 +1482,58 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } x.MintTokenFeeRatio = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field EnableErc20", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.EnableErc20 = bool(v != 0) + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Beacon", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Beacon = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1414,6 +1596,7 @@ type Token struct { MaxSupply uint64 `protobuf:"varint,6,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty"` Mintable bool `protobuf:"varint,7,opt,name=mintable,proto3" json:"mintable,omitempty"` Owner string `protobuf:"bytes,8,opt,name=owner,proto3" json:"owner,omitempty"` + Contract string `protobuf:"bytes,9,opt,name=contract,proto3" json:"contract,omitempty"` } func (x *Token) Reset() { @@ -1492,6 +1675,13 @@ func (x *Token) GetOwner() string { return "" } +func (x *Token) GetContract() string { + if x != nil { + return x.Contract + } + return "" +} + // Params defines token module's parameters type Params struct { state protoimpl.MessageState @@ -1501,6 +1691,8 @@ type Params struct { TokenTaxRate string `protobuf:"bytes,1,opt,name=token_tax_rate,json=tokenTaxRate,proto3" json:"token_tax_rate,omitempty"` IssueTokenBaseFee *v1beta1.Coin `protobuf:"bytes,2,opt,name=issue_token_base_fee,json=issueTokenBaseFee,proto3" json:"issue_token_base_fee,omitempty"` MintTokenFeeRatio string `protobuf:"bytes,3,opt,name=mint_token_fee_ratio,json=mintTokenFeeRatio,proto3" json:"mint_token_fee_ratio,omitempty"` + EnableErc20 bool `protobuf:"varint,4,opt,name=enable_erc20,json=enableErc20,proto3" json:"enable_erc20,omitempty"` + Beacon string `protobuf:"bytes,5,opt,name=beacon,proto3" json:"beacon,omitempty"` } func (x *Params) Reset() { @@ -1544,6 +1736,20 @@ func (x *Params) GetMintTokenFeeRatio() string { return "" } +func (x *Params) GetEnableErc20() bool { + if x != nil { + return x.EnableErc20 + } + return false +} + +func (x *Params) GetBeacon() string { + if x != nil { + return x.Beacon + } + return "" +} + var File_irismod_token_v1_token_proto protoreflect.FileDescriptor var file_irismod_token_v1_token_proto_rawDesc = []byte{ @@ -1553,7 +1759,7 @@ var file_irismod_token_v1_token_proto_rawDesc = []byte{ 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe2, 0x01, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfe, 0x01, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, @@ -1567,38 +1773,43 @@ var file_irismod_token_v1_token_proto_rawDesc = []byte{ 0x70, 0x6c, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x69, 0x6e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0x97, 0x02, 0x0a, 0x06, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x54, 0x0a, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, - 0x74, 0x61, 0x78, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2e, - 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0c, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x61, 0x78, 0x52, 0x61, 0x74, 0x65, 0x12, 0x50, 0x0a, 0x14, - 0x69, 0x73, 0x73, 0x75, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, - 0x5f, 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x11, 0x69, 0x73, 0x73, - 0x75, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x12, 0x5f, - 0x0a, 0x14, 0x6d, 0x69, 0x6e, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x66, 0x65, 0x65, - 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2e, 0xc8, 0xde, - 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, - 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x11, 0x6d, 0x69, - 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x3a, - 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xc1, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, - 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, - 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, - 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, 0x10, 0x49, 0x72, - 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, - 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, - 0x31, 0xe2, 0x02, 0x1c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x12, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, + 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, + 0x74, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0xd2, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x54, 0x0a, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x61, 0x78, 0x5f, + 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2e, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0c, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x54, 0x61, 0x78, 0x52, 0x61, 0x74, 0x65, 0x12, 0x50, 0x0a, 0x14, 0x69, 0x73, 0x73, 0x75, + 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x66, 0x65, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, + 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x11, 0x69, 0x73, 0x73, 0x75, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x42, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x12, 0x5f, 0x0a, 0x14, 0x6d, 0x69, + 0x6e, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2e, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, + 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x11, 0x6d, 0x69, 0x6e, 0x74, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0b, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x72, 0x63, 0x32, 0x30, 0x12, 0x16, + 0x0a, 0x06, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xc1, 0x01, 0xc8, + 0xe1, 0x1e, 0x00, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x76, 0x31, + 0xa2, 0x02, 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x49, + 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x49, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/irismod/token/v1/tx.pulsar.go b/api/irismod/token/v1/tx.pulsar.go index 8d02d86e..199ff332 100644 --- a/api/irismod/token/v1/tx.pulsar.go +++ b/api/irismod/token/v1/tx.pulsar.go @@ -3103,17 +3103,17 @@ func (x *fastReflection_MsgEditTokenResponse) ProtoMethods() *protoiface.Methods } var ( - md_MsgMintToken protoreflect.MessageDescriptor - fd_MsgMintToken_coin protoreflect.FieldDescriptor - fd_MsgMintToken_to protoreflect.FieldDescriptor - fd_MsgMintToken_owner protoreflect.FieldDescriptor + md_MsgMintToken protoreflect.MessageDescriptor + fd_MsgMintToken_coin protoreflect.FieldDescriptor + fd_MsgMintToken_receiver protoreflect.FieldDescriptor + fd_MsgMintToken_owner protoreflect.FieldDescriptor ) func init() { file_irismod_token_v1_tx_proto_init() md_MsgMintToken = File_irismod_token_v1_tx_proto.Messages().ByName("MsgMintToken") fd_MsgMintToken_coin = md_MsgMintToken.Fields().ByName("coin") - fd_MsgMintToken_to = md_MsgMintToken.Fields().ByName("to") + fd_MsgMintToken_receiver = md_MsgMintToken.Fields().ByName("receiver") fd_MsgMintToken_owner = md_MsgMintToken.Fields().ByName("owner") } @@ -3188,9 +3188,9 @@ func (x *fastReflection_MsgMintToken) Range(f func(protoreflect.FieldDescriptor, return } } - if x.To != "" { - value := protoreflect.ValueOfString(x.To) - if !f(fd_MsgMintToken_to, value) { + if x.Receiver != "" { + value := protoreflect.ValueOfString(x.Receiver) + if !f(fd_MsgMintToken_receiver, value) { return } } @@ -3217,8 +3217,8 @@ func (x *fastReflection_MsgMintToken) Has(fd protoreflect.FieldDescriptor) bool switch fd.FullName() { case "irismod.token.v1.MsgMintToken.coin": return x.Coin != nil - case "irismod.token.v1.MsgMintToken.to": - return x.To != "" + case "irismod.token.v1.MsgMintToken.receiver": + return x.Receiver != "" case "irismod.token.v1.MsgMintToken.owner": return x.Owner != "" default: @@ -3239,8 +3239,8 @@ func (x *fastReflection_MsgMintToken) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "irismod.token.v1.MsgMintToken.coin": x.Coin = nil - case "irismod.token.v1.MsgMintToken.to": - x.To = "" + case "irismod.token.v1.MsgMintToken.receiver": + x.Receiver = "" case "irismod.token.v1.MsgMintToken.owner": x.Owner = "" default: @@ -3262,8 +3262,8 @@ func (x *fastReflection_MsgMintToken) Get(descriptor protoreflect.FieldDescripto case "irismod.token.v1.MsgMintToken.coin": value := x.Coin return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "irismod.token.v1.MsgMintToken.to": - value := x.To + case "irismod.token.v1.MsgMintToken.receiver": + value := x.Receiver return protoreflect.ValueOfString(value) case "irismod.token.v1.MsgMintToken.owner": value := x.Owner @@ -3290,8 +3290,8 @@ func (x *fastReflection_MsgMintToken) Set(fd protoreflect.FieldDescriptor, value switch fd.FullName() { case "irismod.token.v1.MsgMintToken.coin": x.Coin = value.Message().Interface().(*v1beta1.Coin) - case "irismod.token.v1.MsgMintToken.to": - x.To = value.Interface().(string) + case "irismod.token.v1.MsgMintToken.receiver": + x.Receiver = value.Interface().(string) case "irismod.token.v1.MsgMintToken.owner": x.Owner = value.Interface().(string) default: @@ -3319,8 +3319,8 @@ func (x *fastReflection_MsgMintToken) Mutable(fd protoreflect.FieldDescriptor) p x.Coin = new(v1beta1.Coin) } return protoreflect.ValueOfMessage(x.Coin.ProtoReflect()) - case "irismod.token.v1.MsgMintToken.to": - panic(fmt.Errorf("field to of message irismod.token.v1.MsgMintToken is not mutable")) + case "irismod.token.v1.MsgMintToken.receiver": + panic(fmt.Errorf("field receiver of message irismod.token.v1.MsgMintToken is not mutable")) case "irismod.token.v1.MsgMintToken.owner": panic(fmt.Errorf("field owner of message irismod.token.v1.MsgMintToken is not mutable")) default: @@ -3339,7 +3339,7 @@ func (x *fastReflection_MsgMintToken) NewField(fd protoreflect.FieldDescriptor) case "irismod.token.v1.MsgMintToken.coin": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "irismod.token.v1.MsgMintToken.to": + case "irismod.token.v1.MsgMintToken.receiver": return protoreflect.ValueOfString("") case "irismod.token.v1.MsgMintToken.owner": return protoreflect.ValueOfString("") @@ -3416,7 +3416,7 @@ func (x *fastReflection_MsgMintToken) ProtoMethods() *protoiface.Methods { l = options.Size(x.Coin) n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.To) + l = len(x.Receiver) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -3460,10 +3460,10 @@ func (x *fastReflection_MsgMintToken) ProtoMethods() *protoiface.Methods { i-- dAtA[i] = 0x1a } - if len(x.To) > 0 { - i -= len(x.To) - copy(dAtA[i:], x.To) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.To))) + if len(x.Receiver) > 0 { + i -= len(x.Receiver) + copy(dAtA[i:], x.Receiver) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Receiver))) i-- dAtA[i] = 0x12 } @@ -3568,7 +3568,7 @@ func (x *fastReflection_MsgMintToken) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3596,7 +3596,7 @@ func (x *fastReflection_MsgMintToken) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.To = string(dAtA[iNdEx:postIndex]) + x.Receiver = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -4877,17 +4877,17 @@ func (x *fastReflection_MsgBurnTokenResponse) ProtoMethods() *protoiface.Methods } var ( - md_MsgSwapFeeToken protoreflect.MessageDescriptor - fd_MsgSwapFeeToken_fee_paid protoreflect.FieldDescriptor - fd_MsgSwapFeeToken_recipient protoreflect.FieldDescriptor - fd_MsgSwapFeeToken_sender protoreflect.FieldDescriptor + md_MsgSwapFeeToken protoreflect.MessageDescriptor + fd_MsgSwapFeeToken_fee_paid protoreflect.FieldDescriptor + fd_MsgSwapFeeToken_receiver protoreflect.FieldDescriptor + fd_MsgSwapFeeToken_sender protoreflect.FieldDescriptor ) func init() { file_irismod_token_v1_tx_proto_init() md_MsgSwapFeeToken = File_irismod_token_v1_tx_proto.Messages().ByName("MsgSwapFeeToken") fd_MsgSwapFeeToken_fee_paid = md_MsgSwapFeeToken.Fields().ByName("fee_paid") - fd_MsgSwapFeeToken_recipient = md_MsgSwapFeeToken.Fields().ByName("recipient") + fd_MsgSwapFeeToken_receiver = md_MsgSwapFeeToken.Fields().ByName("receiver") fd_MsgSwapFeeToken_sender = md_MsgSwapFeeToken.Fields().ByName("sender") } @@ -4962,9 +4962,9 @@ func (x *fastReflection_MsgSwapFeeToken) Range(f func(protoreflect.FieldDescript return } } - if x.Recipient != "" { - value := protoreflect.ValueOfString(x.Recipient) - if !f(fd_MsgSwapFeeToken_recipient, value) { + if x.Receiver != "" { + value := protoreflect.ValueOfString(x.Receiver) + if !f(fd_MsgSwapFeeToken_receiver, value) { return } } @@ -4991,8 +4991,8 @@ func (x *fastReflection_MsgSwapFeeToken) Has(fd protoreflect.FieldDescriptor) bo switch fd.FullName() { case "irismod.token.v1.MsgSwapFeeToken.fee_paid": return x.FeePaid != nil - case "irismod.token.v1.MsgSwapFeeToken.recipient": - return x.Recipient != "" + case "irismod.token.v1.MsgSwapFeeToken.receiver": + return x.Receiver != "" case "irismod.token.v1.MsgSwapFeeToken.sender": return x.Sender != "" default: @@ -5013,8 +5013,8 @@ func (x *fastReflection_MsgSwapFeeToken) Clear(fd protoreflect.FieldDescriptor) switch fd.FullName() { case "irismod.token.v1.MsgSwapFeeToken.fee_paid": x.FeePaid = nil - case "irismod.token.v1.MsgSwapFeeToken.recipient": - x.Recipient = "" + case "irismod.token.v1.MsgSwapFeeToken.receiver": + x.Receiver = "" case "irismod.token.v1.MsgSwapFeeToken.sender": x.Sender = "" default: @@ -5036,8 +5036,8 @@ func (x *fastReflection_MsgSwapFeeToken) Get(descriptor protoreflect.FieldDescri case "irismod.token.v1.MsgSwapFeeToken.fee_paid": value := x.FeePaid return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "irismod.token.v1.MsgSwapFeeToken.recipient": - value := x.Recipient + case "irismod.token.v1.MsgSwapFeeToken.receiver": + value := x.Receiver return protoreflect.ValueOfString(value) case "irismod.token.v1.MsgSwapFeeToken.sender": value := x.Sender @@ -5064,8 +5064,8 @@ func (x *fastReflection_MsgSwapFeeToken) Set(fd protoreflect.FieldDescriptor, va switch fd.FullName() { case "irismod.token.v1.MsgSwapFeeToken.fee_paid": x.FeePaid = value.Message().Interface().(*v1beta1.Coin) - case "irismod.token.v1.MsgSwapFeeToken.recipient": - x.Recipient = value.Interface().(string) + case "irismod.token.v1.MsgSwapFeeToken.receiver": + x.Receiver = value.Interface().(string) case "irismod.token.v1.MsgSwapFeeToken.sender": x.Sender = value.Interface().(string) default: @@ -5093,8 +5093,8 @@ func (x *fastReflection_MsgSwapFeeToken) Mutable(fd protoreflect.FieldDescriptor x.FeePaid = new(v1beta1.Coin) } return protoreflect.ValueOfMessage(x.FeePaid.ProtoReflect()) - case "irismod.token.v1.MsgSwapFeeToken.recipient": - panic(fmt.Errorf("field recipient of message irismod.token.v1.MsgSwapFeeToken is not mutable")) + case "irismod.token.v1.MsgSwapFeeToken.receiver": + panic(fmt.Errorf("field receiver of message irismod.token.v1.MsgSwapFeeToken is not mutable")) case "irismod.token.v1.MsgSwapFeeToken.sender": panic(fmt.Errorf("field sender of message irismod.token.v1.MsgSwapFeeToken is not mutable")) default: @@ -5113,7 +5113,7 @@ func (x *fastReflection_MsgSwapFeeToken) NewField(fd protoreflect.FieldDescripto case "irismod.token.v1.MsgSwapFeeToken.fee_paid": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "irismod.token.v1.MsgSwapFeeToken.recipient": + case "irismod.token.v1.MsgSwapFeeToken.receiver": return protoreflect.ValueOfString("") case "irismod.token.v1.MsgSwapFeeToken.sender": return protoreflect.ValueOfString("") @@ -5190,7 +5190,7 @@ func (x *fastReflection_MsgSwapFeeToken) ProtoMethods() *protoiface.Methods { l = options.Size(x.FeePaid) n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Recipient) + l = len(x.Receiver) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -5234,10 +5234,10 @@ func (x *fastReflection_MsgSwapFeeToken) ProtoMethods() *protoiface.Methods { i-- dAtA[i] = 0x1a } - if len(x.Recipient) > 0 { - i -= len(x.Recipient) - copy(dAtA[i:], x.Recipient) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Recipient))) + if len(x.Receiver) > 0 { + i -= len(x.Receiver) + copy(dAtA[i:], x.Receiver) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Receiver))) i-- dAtA[i] = 0x12 } @@ -5342,7 +5342,7 @@ func (x *fastReflection_MsgSwapFeeToken) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5370,7 +5370,7 @@ func (x *fastReflection_MsgSwapFeeToken) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Recipient = string(dAtA[iNdEx:postIndex]) + x.Receiver = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -6729,630 +6729,4649 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } +var ( + md_MsgDeployERC20 protoreflect.MessageDescriptor + fd_MsgDeployERC20_symbol protoreflect.FieldDescriptor + fd_MsgDeployERC20_name protoreflect.FieldDescriptor + fd_MsgDeployERC20_scale protoreflect.FieldDescriptor + fd_MsgDeployERC20_min_unit protoreflect.FieldDescriptor + fd_MsgDeployERC20_authority protoreflect.FieldDescriptor +) + +func init() { + file_irismod_token_v1_tx_proto_init() + md_MsgDeployERC20 = File_irismod_token_v1_tx_proto.Messages().ByName("MsgDeployERC20") + fd_MsgDeployERC20_symbol = md_MsgDeployERC20.Fields().ByName("symbol") + fd_MsgDeployERC20_name = md_MsgDeployERC20.Fields().ByName("name") + fd_MsgDeployERC20_scale = md_MsgDeployERC20.Fields().ByName("scale") + fd_MsgDeployERC20_min_unit = md_MsgDeployERC20.Fields().ByName("min_unit") + fd_MsgDeployERC20_authority = md_MsgDeployERC20.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_MsgDeployERC20)(nil) + +type fastReflection_MsgDeployERC20 MsgDeployERC20 + +func (x *MsgDeployERC20) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgDeployERC20)(x) +} + +func (x *MsgDeployERC20) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_tx_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgDeployERC20_messageType fastReflection_MsgDeployERC20_messageType +var _ protoreflect.MessageType = fastReflection_MsgDeployERC20_messageType{} + +type fastReflection_MsgDeployERC20_messageType struct{} + +func (x fastReflection_MsgDeployERC20_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgDeployERC20)(nil) +} +func (x fastReflection_MsgDeployERC20_messageType) New() protoreflect.Message { + return new(fastReflection_MsgDeployERC20) +} +func (x fastReflection_MsgDeployERC20_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDeployERC20 +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgDeployERC20) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDeployERC20 +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgDeployERC20) Type() protoreflect.MessageType { + return _fastReflection_MsgDeployERC20_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgDeployERC20) New() protoreflect.Message { + return new(fastReflection_MsgDeployERC20) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgDeployERC20) Interface() protoreflect.ProtoMessage { + return (*MsgDeployERC20)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgDeployERC20) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Symbol != "" { + value := protoreflect.ValueOfString(x.Symbol) + if !f(fd_MsgDeployERC20_symbol, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_MsgDeployERC20_name, value) { + return + } + } + if x.Scale != uint32(0) { + value := protoreflect.ValueOfUint32(x.Scale) + if !f(fd_MsgDeployERC20_scale, value) { + return + } + } + if x.MinUnit != "" { + value := protoreflect.ValueOfString(x.MinUnit) + if !f(fd_MsgDeployERC20_min_unit, value) { + return + } + } + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgDeployERC20_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgDeployERC20) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "irismod.token.v1.MsgDeployERC20.symbol": + return x.Symbol != "" + case "irismod.token.v1.MsgDeployERC20.name": + return x.Name != "" + case "irismod.token.v1.MsgDeployERC20.scale": + return x.Scale != uint32(0) + case "irismod.token.v1.MsgDeployERC20.min_unit": + return x.MinUnit != "" + case "irismod.token.v1.MsgDeployERC20.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20 does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeployERC20) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "irismod.token.v1.MsgDeployERC20.symbol": + x.Symbol = "" + case "irismod.token.v1.MsgDeployERC20.name": + x.Name = "" + case "irismod.token.v1.MsgDeployERC20.scale": + x.Scale = uint32(0) + case "irismod.token.v1.MsgDeployERC20.min_unit": + x.MinUnit = "" + case "irismod.token.v1.MsgDeployERC20.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20 does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgDeployERC20) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "irismod.token.v1.MsgDeployERC20.symbol": + value := x.Symbol + return protoreflect.ValueOfString(value) + case "irismod.token.v1.MsgDeployERC20.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "irismod.token.v1.MsgDeployERC20.scale": + value := x.Scale + return protoreflect.ValueOfUint32(value) + case "irismod.token.v1.MsgDeployERC20.min_unit": + value := x.MinUnit + return protoreflect.ValueOfString(value) + case "irismod.token.v1.MsgDeployERC20.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20 does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeployERC20) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "irismod.token.v1.MsgDeployERC20.symbol": + x.Symbol = value.Interface().(string) + case "irismod.token.v1.MsgDeployERC20.name": + x.Name = value.Interface().(string) + case "irismod.token.v1.MsgDeployERC20.scale": + x.Scale = uint32(value.Uint()) + case "irismod.token.v1.MsgDeployERC20.min_unit": + x.MinUnit = value.Interface().(string) + case "irismod.token.v1.MsgDeployERC20.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20 does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeployERC20) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.MsgDeployERC20.symbol": + panic(fmt.Errorf("field symbol of message irismod.token.v1.MsgDeployERC20 is not mutable")) + case "irismod.token.v1.MsgDeployERC20.name": + panic(fmt.Errorf("field name of message irismod.token.v1.MsgDeployERC20 is not mutable")) + case "irismod.token.v1.MsgDeployERC20.scale": + panic(fmt.Errorf("field scale of message irismod.token.v1.MsgDeployERC20 is not mutable")) + case "irismod.token.v1.MsgDeployERC20.min_unit": + panic(fmt.Errorf("field min_unit of message irismod.token.v1.MsgDeployERC20 is not mutable")) + case "irismod.token.v1.MsgDeployERC20.authority": + panic(fmt.Errorf("field authority of message irismod.token.v1.MsgDeployERC20 is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20 does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgDeployERC20) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.MsgDeployERC20.symbol": + return protoreflect.ValueOfString("") + case "irismod.token.v1.MsgDeployERC20.name": + return protoreflect.ValueOfString("") + case "irismod.token.v1.MsgDeployERC20.scale": + return protoreflect.ValueOfUint32(uint32(0)) + case "irismod.token.v1.MsgDeployERC20.min_unit": + return protoreflect.ValueOfString("") + case "irismod.token.v1.MsgDeployERC20.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20 does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgDeployERC20) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.MsgDeployERC20", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgDeployERC20) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeployERC20) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgDeployERC20) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgDeployERC20) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgDeployERC20) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Symbol) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Scale != 0 { + n += 1 + runtime.Sov(uint64(x.Scale)) + } + l = len(x.MinUnit) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgDeployERC20) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0x2a + } + if len(x.MinUnit) > 0 { + i -= len(x.MinUnit) + copy(dAtA[i:], x.MinUnit) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinUnit))) + i-- + dAtA[i] = 0x22 + } + if x.Scale != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Scale)) + i-- + dAtA[i] = 0x18 + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Symbol) > 0 { + i -= len(x.Symbol) + copy(dAtA[i:], x.Symbol) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Symbol))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgDeployERC20) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDeployERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDeployERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Scale", wireType) + } + x.Scale = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Scale |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinUnit", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.MinUnit = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgDeployERC20Response protoreflect.MessageDescriptor +) + +func init() { + file_irismod_token_v1_tx_proto_init() + md_MsgDeployERC20Response = File_irismod_token_v1_tx_proto.Messages().ByName("MsgDeployERC20Response") +} + +var _ protoreflect.Message = (*fastReflection_MsgDeployERC20Response)(nil) + +type fastReflection_MsgDeployERC20Response MsgDeployERC20Response + +func (x *MsgDeployERC20Response) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgDeployERC20Response)(x) +} + +func (x *MsgDeployERC20Response) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_tx_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgDeployERC20Response_messageType fastReflection_MsgDeployERC20Response_messageType +var _ protoreflect.MessageType = fastReflection_MsgDeployERC20Response_messageType{} + +type fastReflection_MsgDeployERC20Response_messageType struct{} + +func (x fastReflection_MsgDeployERC20Response_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgDeployERC20Response)(nil) +} +func (x fastReflection_MsgDeployERC20Response_messageType) New() protoreflect.Message { + return new(fastReflection_MsgDeployERC20Response) +} +func (x fastReflection_MsgDeployERC20Response_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDeployERC20Response +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgDeployERC20Response) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDeployERC20Response +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgDeployERC20Response) Type() protoreflect.MessageType { + return _fastReflection_MsgDeployERC20Response_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgDeployERC20Response) New() protoreflect.Message { + return new(fastReflection_MsgDeployERC20Response) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgDeployERC20Response) Interface() protoreflect.ProtoMessage { + return (*MsgDeployERC20Response)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgDeployERC20Response) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgDeployERC20Response) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20Response does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeployERC20Response) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20Response does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgDeployERC20Response) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20Response does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeployERC20Response) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20Response does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeployERC20Response) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20Response does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgDeployERC20Response) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgDeployERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgDeployERC20Response does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgDeployERC20Response) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.MsgDeployERC20Response", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgDeployERC20Response) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDeployERC20Response) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgDeployERC20Response) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgDeployERC20Response) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgDeployERC20Response) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgDeployERC20Response) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgDeployERC20Response) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDeployERC20Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDeployERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgSwapToERC20 protoreflect.MessageDescriptor + fd_MsgSwapToERC20_amount protoreflect.FieldDescriptor + fd_MsgSwapToERC20_sender protoreflect.FieldDescriptor + fd_MsgSwapToERC20_receiver protoreflect.FieldDescriptor +) + +func init() { + file_irismod_token_v1_tx_proto_init() + md_MsgSwapToERC20 = File_irismod_token_v1_tx_proto.Messages().ByName("MsgSwapToERC20") + fd_MsgSwapToERC20_amount = md_MsgSwapToERC20.Fields().ByName("amount") + fd_MsgSwapToERC20_sender = md_MsgSwapToERC20.Fields().ByName("sender") + fd_MsgSwapToERC20_receiver = md_MsgSwapToERC20.Fields().ByName("receiver") +} + +var _ protoreflect.Message = (*fastReflection_MsgSwapToERC20)(nil) + +type fastReflection_MsgSwapToERC20 MsgSwapToERC20 + +func (x *MsgSwapToERC20) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSwapToERC20)(x) +} + +func (x *MsgSwapToERC20) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_tx_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgSwapToERC20_messageType fastReflection_MsgSwapToERC20_messageType +var _ protoreflect.MessageType = fastReflection_MsgSwapToERC20_messageType{} + +type fastReflection_MsgSwapToERC20_messageType struct{} + +func (x fastReflection_MsgSwapToERC20_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSwapToERC20)(nil) +} +func (x fastReflection_MsgSwapToERC20_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSwapToERC20) +} +func (x fastReflection_MsgSwapToERC20_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSwapToERC20 +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSwapToERC20) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSwapToERC20 +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgSwapToERC20) Type() protoreflect.MessageType { + return _fastReflection_MsgSwapToERC20_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSwapToERC20) New() protoreflect.Message { + return new(fastReflection_MsgSwapToERC20) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSwapToERC20) Interface() protoreflect.ProtoMessage { + return (*MsgSwapToERC20)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgSwapToERC20) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_MsgSwapToERC20_amount, value) { + return + } + } + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_MsgSwapToERC20_sender, value) { + return + } + } + if x.Receiver != "" { + value := protoreflect.ValueOfString(x.Receiver) + if !f(fd_MsgSwapToERC20_receiver, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgSwapToERC20) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "irismod.token.v1.MsgSwapToERC20.amount": + return x.Amount != nil + case "irismod.token.v1.MsgSwapToERC20.sender": + return x.Sender != "" + case "irismod.token.v1.MsgSwapToERC20.receiver": + return x.Receiver != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20 does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapToERC20) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "irismod.token.v1.MsgSwapToERC20.amount": + x.Amount = nil + case "irismod.token.v1.MsgSwapToERC20.sender": + x.Sender = "" + case "irismod.token.v1.MsgSwapToERC20.receiver": + x.Receiver = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20 does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgSwapToERC20) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "irismod.token.v1.MsgSwapToERC20.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "irismod.token.v1.MsgSwapToERC20.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + case "irismod.token.v1.MsgSwapToERC20.receiver": + value := x.Receiver + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20 does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapToERC20) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "irismod.token.v1.MsgSwapToERC20.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) + case "irismod.token.v1.MsgSwapToERC20.sender": + x.Sender = value.Interface().(string) + case "irismod.token.v1.MsgSwapToERC20.receiver": + x.Receiver = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20 does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapToERC20) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.MsgSwapToERC20.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + case "irismod.token.v1.MsgSwapToERC20.sender": + panic(fmt.Errorf("field sender of message irismod.token.v1.MsgSwapToERC20 is not mutable")) + case "irismod.token.v1.MsgSwapToERC20.receiver": + panic(fmt.Errorf("field receiver of message irismod.token.v1.MsgSwapToERC20 is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20 does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgSwapToERC20) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.MsgSwapToERC20.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "irismod.token.v1.MsgSwapToERC20.sender": + return protoreflect.ValueOfString("") + case "irismod.token.v1.MsgSwapToERC20.receiver": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20 does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgSwapToERC20) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.MsgSwapToERC20", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgSwapToERC20) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapToERC20) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgSwapToERC20) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgSwapToERC20) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSwapToERC20) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Sender) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Receiver) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgSwapToERC20) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Receiver) > 0 { + i -= len(x.Receiver) + copy(dAtA[i:], x.Receiver) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(x.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + i-- + dAtA[i] = 0x12 + } + if x.Amount != nil { + encoded, err := options.Marshal(x.Amount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgSwapToERC20) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSwapToERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSwapToERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgSwapToERC20Response protoreflect.MessageDescriptor +) + +func init() { + file_irismod_token_v1_tx_proto_init() + md_MsgSwapToERC20Response = File_irismod_token_v1_tx_proto.Messages().ByName("MsgSwapToERC20Response") +} + +var _ protoreflect.Message = (*fastReflection_MsgSwapToERC20Response)(nil) + +type fastReflection_MsgSwapToERC20Response MsgSwapToERC20Response + +func (x *MsgSwapToERC20Response) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSwapToERC20Response)(x) +} + +func (x *MsgSwapToERC20Response) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_tx_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgSwapToERC20Response_messageType fastReflection_MsgSwapToERC20Response_messageType +var _ protoreflect.MessageType = fastReflection_MsgSwapToERC20Response_messageType{} + +type fastReflection_MsgSwapToERC20Response_messageType struct{} + +func (x fastReflection_MsgSwapToERC20Response_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSwapToERC20Response)(nil) +} +func (x fastReflection_MsgSwapToERC20Response_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSwapToERC20Response) +} +func (x fastReflection_MsgSwapToERC20Response_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSwapToERC20Response +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSwapToERC20Response) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSwapToERC20Response +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgSwapToERC20Response) Type() protoreflect.MessageType { + return _fastReflection_MsgSwapToERC20Response_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSwapToERC20Response) New() protoreflect.Message { + return new(fastReflection_MsgSwapToERC20Response) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSwapToERC20Response) Interface() protoreflect.ProtoMessage { + return (*MsgSwapToERC20Response)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgSwapToERC20Response) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgSwapToERC20Response) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20Response does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapToERC20Response) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20Response does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgSwapToERC20Response) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20Response does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapToERC20Response) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20Response does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapToERC20Response) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20Response does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgSwapToERC20Response) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapToERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapToERC20Response does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgSwapToERC20Response) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.MsgSwapToERC20Response", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgSwapToERC20Response) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapToERC20Response) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgSwapToERC20Response) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgSwapToERC20Response) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSwapToERC20Response) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgSwapToERC20Response) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgSwapToERC20Response) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSwapToERC20Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSwapToERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgSwapFromERC20 protoreflect.MessageDescriptor + fd_MsgSwapFromERC20_wanted_amount protoreflect.FieldDescriptor + fd_MsgSwapFromERC20_sender protoreflect.FieldDescriptor + fd_MsgSwapFromERC20_receiver protoreflect.FieldDescriptor +) + +func init() { + file_irismod_token_v1_tx_proto_init() + md_MsgSwapFromERC20 = File_irismod_token_v1_tx_proto.Messages().ByName("MsgSwapFromERC20") + fd_MsgSwapFromERC20_wanted_amount = md_MsgSwapFromERC20.Fields().ByName("wanted_amount") + fd_MsgSwapFromERC20_sender = md_MsgSwapFromERC20.Fields().ByName("sender") + fd_MsgSwapFromERC20_receiver = md_MsgSwapFromERC20.Fields().ByName("receiver") +} + +var _ protoreflect.Message = (*fastReflection_MsgSwapFromERC20)(nil) + +type fastReflection_MsgSwapFromERC20 MsgSwapFromERC20 + +func (x *MsgSwapFromERC20) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSwapFromERC20)(x) +} + +func (x *MsgSwapFromERC20) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_tx_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgSwapFromERC20_messageType fastReflection_MsgSwapFromERC20_messageType +var _ protoreflect.MessageType = fastReflection_MsgSwapFromERC20_messageType{} + +type fastReflection_MsgSwapFromERC20_messageType struct{} + +func (x fastReflection_MsgSwapFromERC20_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSwapFromERC20)(nil) +} +func (x fastReflection_MsgSwapFromERC20_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSwapFromERC20) +} +func (x fastReflection_MsgSwapFromERC20_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSwapFromERC20 +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSwapFromERC20) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSwapFromERC20 +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgSwapFromERC20) Type() protoreflect.MessageType { + return _fastReflection_MsgSwapFromERC20_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSwapFromERC20) New() protoreflect.Message { + return new(fastReflection_MsgSwapFromERC20) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSwapFromERC20) Interface() protoreflect.ProtoMessage { + return (*MsgSwapFromERC20)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgSwapFromERC20) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.WantedAmount != nil { + value := protoreflect.ValueOfMessage(x.WantedAmount.ProtoReflect()) + if !f(fd_MsgSwapFromERC20_wanted_amount, value) { + return + } + } + if x.Sender != "" { + value := protoreflect.ValueOfString(x.Sender) + if !f(fd_MsgSwapFromERC20_sender, value) { + return + } + } + if x.Receiver != "" { + value := protoreflect.ValueOfString(x.Receiver) + if !f(fd_MsgSwapFromERC20_receiver, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgSwapFromERC20) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "irismod.token.v1.MsgSwapFromERC20.wanted_amount": + return x.WantedAmount != nil + case "irismod.token.v1.MsgSwapFromERC20.sender": + return x.Sender != "" + case "irismod.token.v1.MsgSwapFromERC20.receiver": + return x.Receiver != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20 does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapFromERC20) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "irismod.token.v1.MsgSwapFromERC20.wanted_amount": + x.WantedAmount = nil + case "irismod.token.v1.MsgSwapFromERC20.sender": + x.Sender = "" + case "irismod.token.v1.MsgSwapFromERC20.receiver": + x.Receiver = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20 does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgSwapFromERC20) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "irismod.token.v1.MsgSwapFromERC20.wanted_amount": + value := x.WantedAmount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "irismod.token.v1.MsgSwapFromERC20.sender": + value := x.Sender + return protoreflect.ValueOfString(value) + case "irismod.token.v1.MsgSwapFromERC20.receiver": + value := x.Receiver + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20 does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapFromERC20) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "irismod.token.v1.MsgSwapFromERC20.wanted_amount": + x.WantedAmount = value.Message().Interface().(*v1beta1.Coin) + case "irismod.token.v1.MsgSwapFromERC20.sender": + x.Sender = value.Interface().(string) + case "irismod.token.v1.MsgSwapFromERC20.receiver": + x.Receiver = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20 does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapFromERC20) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.MsgSwapFromERC20.wanted_amount": + if x.WantedAmount == nil { + x.WantedAmount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.WantedAmount.ProtoReflect()) + case "irismod.token.v1.MsgSwapFromERC20.sender": + panic(fmt.Errorf("field sender of message irismod.token.v1.MsgSwapFromERC20 is not mutable")) + case "irismod.token.v1.MsgSwapFromERC20.receiver": + panic(fmt.Errorf("field receiver of message irismod.token.v1.MsgSwapFromERC20 is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20 does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgSwapFromERC20) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.MsgSwapFromERC20.wanted_amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "irismod.token.v1.MsgSwapFromERC20.sender": + return protoreflect.ValueOfString("") + case "irismod.token.v1.MsgSwapFromERC20.receiver": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20 does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgSwapFromERC20) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.MsgSwapFromERC20", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgSwapFromERC20) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapFromERC20) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgSwapFromERC20) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgSwapFromERC20) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSwapFromERC20) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.WantedAmount != nil { + l = options.Size(x.WantedAmount) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Sender) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Receiver) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgSwapFromERC20) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Receiver) > 0 { + i -= len(x.Receiver) + copy(dAtA[i:], x.Receiver) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(x.Sender) > 0 { + i -= len(x.Sender) + copy(dAtA[i:], x.Sender) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Sender))) + i-- + dAtA[i] = 0x12 + } + if x.WantedAmount != nil { + encoded, err := options.Marshal(x.WantedAmount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgSwapFromERC20) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSwapFromERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSwapFromERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WantedAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.WantedAmount == nil { + x.WantedAmount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.WantedAmount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgSwapFromERC20Response protoreflect.MessageDescriptor +) + +func init() { + file_irismod_token_v1_tx_proto_init() + md_MsgSwapFromERC20Response = File_irismod_token_v1_tx_proto.Messages().ByName("MsgSwapFromERC20Response") +} + +var _ protoreflect.Message = (*fastReflection_MsgSwapFromERC20Response)(nil) + +type fastReflection_MsgSwapFromERC20Response MsgSwapFromERC20Response + +func (x *MsgSwapFromERC20Response) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSwapFromERC20Response)(x) +} + +func (x *MsgSwapFromERC20Response) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_tx_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgSwapFromERC20Response_messageType fastReflection_MsgSwapFromERC20Response_messageType +var _ protoreflect.MessageType = fastReflection_MsgSwapFromERC20Response_messageType{} + +type fastReflection_MsgSwapFromERC20Response_messageType struct{} + +func (x fastReflection_MsgSwapFromERC20Response_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSwapFromERC20Response)(nil) +} +func (x fastReflection_MsgSwapFromERC20Response_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSwapFromERC20Response) +} +func (x fastReflection_MsgSwapFromERC20Response_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSwapFromERC20Response +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSwapFromERC20Response) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSwapFromERC20Response +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgSwapFromERC20Response) Type() protoreflect.MessageType { + return _fastReflection_MsgSwapFromERC20Response_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSwapFromERC20Response) New() protoreflect.Message { + return new(fastReflection_MsgSwapFromERC20Response) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSwapFromERC20Response) Interface() protoreflect.ProtoMessage { + return (*MsgSwapFromERC20Response)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgSwapFromERC20Response) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgSwapFromERC20Response) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20Response does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapFromERC20Response) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20Response does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgSwapFromERC20Response) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20Response does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapFromERC20Response) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20Response does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapFromERC20Response) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20Response does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgSwapFromERC20Response) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgSwapFromERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgSwapFromERC20Response does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgSwapFromERC20Response) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.MsgSwapFromERC20Response", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgSwapFromERC20Response) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSwapFromERC20Response) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgSwapFromERC20Response) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgSwapFromERC20Response) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSwapFromERC20Response) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgSwapFromERC20Response) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgSwapFromERC20Response) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSwapFromERC20Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSwapFromERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpgradeERC20 protoreflect.MessageDescriptor + fd_MsgUpgradeERC20_implementation protoreflect.FieldDescriptor + fd_MsgUpgradeERC20_authority protoreflect.FieldDescriptor +) + +func init() { + file_irismod_token_v1_tx_proto_init() + md_MsgUpgradeERC20 = File_irismod_token_v1_tx_proto.Messages().ByName("MsgUpgradeERC20") + fd_MsgUpgradeERC20_implementation = md_MsgUpgradeERC20.Fields().ByName("implementation") + fd_MsgUpgradeERC20_authority = md_MsgUpgradeERC20.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpgradeERC20)(nil) + +type fastReflection_MsgUpgradeERC20 MsgUpgradeERC20 + +func (x *MsgUpgradeERC20) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpgradeERC20)(x) +} + +func (x *MsgUpgradeERC20) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_tx_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpgradeERC20_messageType fastReflection_MsgUpgradeERC20_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpgradeERC20_messageType{} + +type fastReflection_MsgUpgradeERC20_messageType struct{} + +func (x fastReflection_MsgUpgradeERC20_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpgradeERC20)(nil) +} +func (x fastReflection_MsgUpgradeERC20_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpgradeERC20) +} +func (x fastReflection_MsgUpgradeERC20_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpgradeERC20 +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpgradeERC20) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpgradeERC20 +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpgradeERC20) Type() protoreflect.MessageType { + return _fastReflection_MsgUpgradeERC20_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpgradeERC20) New() protoreflect.Message { + return new(fastReflection_MsgUpgradeERC20) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpgradeERC20) Interface() protoreflect.ProtoMessage { + return (*MsgUpgradeERC20)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpgradeERC20) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Implementation != "" { + value := protoreflect.ValueOfString(x.Implementation) + if !f(fd_MsgUpgradeERC20_implementation, value) { + return + } + } + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpgradeERC20_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpgradeERC20) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "irismod.token.v1.MsgUpgradeERC20.implementation": + return x.Implementation != "" + case "irismod.token.v1.MsgUpgradeERC20.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20 does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpgradeERC20) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "irismod.token.v1.MsgUpgradeERC20.implementation": + x.Implementation = "" + case "irismod.token.v1.MsgUpgradeERC20.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20 does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpgradeERC20) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "irismod.token.v1.MsgUpgradeERC20.implementation": + value := x.Implementation + return protoreflect.ValueOfString(value) + case "irismod.token.v1.MsgUpgradeERC20.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20 does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpgradeERC20) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "irismod.token.v1.MsgUpgradeERC20.implementation": + x.Implementation = value.Interface().(string) + case "irismod.token.v1.MsgUpgradeERC20.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20 does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpgradeERC20) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.MsgUpgradeERC20.implementation": + panic(fmt.Errorf("field implementation of message irismod.token.v1.MsgUpgradeERC20 is not mutable")) + case "irismod.token.v1.MsgUpgradeERC20.authority": + panic(fmt.Errorf("field authority of message irismod.token.v1.MsgUpgradeERC20 is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20 does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpgradeERC20) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "irismod.token.v1.MsgUpgradeERC20.implementation": + return protoreflect.ValueOfString("") + case "irismod.token.v1.MsgUpgradeERC20.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20 does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpgradeERC20) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.MsgUpgradeERC20", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpgradeERC20) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpgradeERC20) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpgradeERC20) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpgradeERC20) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpgradeERC20) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Implementation) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpgradeERC20) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0x12 + } + if len(x.Implementation) > 0 { + i -= len(x.Implementation) + copy(dAtA[i:], x.Implementation) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Implementation))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpgradeERC20) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpgradeERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpgradeERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Implementation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Implementation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpgradeERC20Response protoreflect.MessageDescriptor +) + +func init() { + file_irismod_token_v1_tx_proto_init() + md_MsgUpgradeERC20Response = File_irismod_token_v1_tx_proto.Messages().ByName("MsgUpgradeERC20Response") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpgradeERC20Response)(nil) + +type fastReflection_MsgUpgradeERC20Response MsgUpgradeERC20Response + +func (x *MsgUpgradeERC20Response) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpgradeERC20Response)(x) +} + +func (x *MsgUpgradeERC20Response) slowProtoReflect() protoreflect.Message { + mi := &file_irismod_token_v1_tx_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpgradeERC20Response_messageType fastReflection_MsgUpgradeERC20Response_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpgradeERC20Response_messageType{} + +type fastReflection_MsgUpgradeERC20Response_messageType struct{} + +func (x fastReflection_MsgUpgradeERC20Response_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpgradeERC20Response)(nil) +} +func (x fastReflection_MsgUpgradeERC20Response_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpgradeERC20Response) +} +func (x fastReflection_MsgUpgradeERC20Response_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpgradeERC20Response +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpgradeERC20Response) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpgradeERC20Response +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpgradeERC20Response) Type() protoreflect.MessageType { + return _fastReflection_MsgUpgradeERC20Response_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpgradeERC20Response) New() protoreflect.Message { + return new(fastReflection_MsgUpgradeERC20Response) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpgradeERC20Response) Interface() protoreflect.ProtoMessage { + return (*MsgUpgradeERC20Response)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpgradeERC20Response) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpgradeERC20Response) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20Response does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpgradeERC20Response) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20Response does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpgradeERC20Response) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20Response does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpgradeERC20Response) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20Response does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpgradeERC20Response) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20Response does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpgradeERC20Response) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.MsgUpgradeERC20Response")) + } + panic(fmt.Errorf("message irismod.token.v1.MsgUpgradeERC20Response does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpgradeERC20Response) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in irismod.token.v1.MsgUpgradeERC20Response", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpgradeERC20Response) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpgradeERC20Response) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpgradeERC20Response) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpgradeERC20Response) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpgradeERC20Response) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpgradeERC20Response) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpgradeERC20Response) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpgradeERC20Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpgradeERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 // protoc (unknown) // source: irismod/token/v1/tx.proto -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgIssueToken defines an SDK message for issuing a new token +type MsgIssueToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Scale uint32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"` + MinUnit string `protobuf:"bytes,4,opt,name=min_unit,json=minUnit,proto3" json:"min_unit,omitempty"` + InitialSupply uint64 `protobuf:"varint,5,opt,name=initial_supply,json=initialSupply,proto3" json:"initial_supply,omitempty"` + MaxSupply uint64 `protobuf:"varint,6,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty"` + Mintable bool `protobuf:"varint,7,opt,name=mintable,proto3" json:"mintable,omitempty"` + Owner string `protobuf:"bytes,8,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (x *MsgIssueToken) Reset() { + *x = MsgIssueToken{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgIssueToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgIssueToken) ProtoMessage() {} + +// Deprecated: Use MsgIssueToken.ProtoReflect.Descriptor instead. +func (*MsgIssueToken) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgIssueToken) GetSymbol() string { + if x != nil { + return x.Symbol + } + return "" +} + +func (x *MsgIssueToken) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MsgIssueToken) GetScale() uint32 { + if x != nil { + return x.Scale + } + return 0 +} + +func (x *MsgIssueToken) GetMinUnit() string { + if x != nil { + return x.MinUnit + } + return "" +} + +func (x *MsgIssueToken) GetInitialSupply() uint64 { + if x != nil { + return x.InitialSupply + } + return 0 +} -// MsgIssueToken defines an SDK message for issuing a new token -type MsgIssueToken struct { +func (x *MsgIssueToken) GetMaxSupply() uint64 { + if x != nil { + return x.MaxSupply + } + return 0 +} + +func (x *MsgIssueToken) GetMintable() bool { + if x != nil { + return x.Mintable + } + return false +} + +func (x *MsgIssueToken) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +// MsgIssueTokenResponse defines the Msg/IssueToken response type +type MsgIssueTokenResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields +} - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Scale uint32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"` - MinUnit string `protobuf:"bytes,4,opt,name=min_unit,json=minUnit,proto3" json:"min_unit,omitempty"` - InitialSupply uint64 `protobuf:"varint,5,opt,name=initial_supply,json=initialSupply,proto3" json:"initial_supply,omitempty"` - MaxSupply uint64 `protobuf:"varint,6,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty"` - Mintable bool `protobuf:"varint,7,opt,name=mintable,proto3" json:"mintable,omitempty"` - Owner string `protobuf:"bytes,8,opt,name=owner,proto3" json:"owner,omitempty"` +func (x *MsgIssueTokenResponse) Reset() { + *x = MsgIssueTokenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (x *MsgIssueToken) Reset() { - *x = MsgIssueToken{} +func (x *MsgIssueTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgIssueTokenResponse) ProtoMessage() {} + +// Deprecated: Use MsgIssueTokenResponse.ProtoReflect.Descriptor instead. +func (*MsgIssueTokenResponse) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{1} +} + +// MsgTransferTokenOwner defines an SDK message for transferring the token owner +type MsgTransferTokenOwner struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SrcOwner string `protobuf:"bytes,1,opt,name=src_owner,json=srcOwner,proto3" json:"src_owner,omitempty"` + DstOwner string `protobuf:"bytes,2,opt,name=dst_owner,json=dstOwner,proto3" json:"dst_owner,omitempty"` + Symbol string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"` +} + +func (x *MsgTransferTokenOwner) Reset() { + *x = MsgTransferTokenOwner{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[0] + mi := &file_irismod_token_v1_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgTransferTokenOwner) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgTransferTokenOwner) ProtoMessage() {} + +// Deprecated: Use MsgTransferTokenOwner.ProtoReflect.Descriptor instead. +func (*MsgTransferTokenOwner) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgTransferTokenOwner) GetSrcOwner() string { + if x != nil { + return x.SrcOwner + } + return "" +} + +func (x *MsgTransferTokenOwner) GetDstOwner() string { + if x != nil { + return x.DstOwner + } + return "" +} + +func (x *MsgTransferTokenOwner) GetSymbol() string { + if x != nil { + return x.Symbol + } + return "" +} + +// MsgTransferTokenOwnerResponse defines the Msg/TransferTokenOwner response +// type +type MsgTransferTokenOwnerResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgTransferTokenOwnerResponse) Reset() { + *x = MsgTransferTokenOwnerResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgTransferTokenOwnerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgTransferTokenOwnerResponse) ProtoMessage() {} + +// Deprecated: Use MsgTransferTokenOwnerResponse.ProtoReflect.Descriptor instead. +func (*MsgTransferTokenOwnerResponse) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{3} +} + +// MsgEditToken defines an SDK message for editing a new token +type MsgEditToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + MaxSupply uint64 `protobuf:"varint,3,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty"` + Mintable string `protobuf:"bytes,4,opt,name=mintable,proto3" json:"mintable,omitempty"` + Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (x *MsgEditToken) Reset() { + *x = MsgEditToken{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgEditToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgEditToken) ProtoMessage() {} + +// Deprecated: Use MsgEditToken.ProtoReflect.Descriptor instead. +func (*MsgEditToken) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgEditToken) GetSymbol() string { + if x != nil { + return x.Symbol + } + return "" +} + +func (x *MsgEditToken) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MsgEditToken) GetMaxSupply() uint64 { + if x != nil { + return x.MaxSupply + } + return 0 +} + +func (x *MsgEditToken) GetMintable() string { + if x != nil { + return x.Mintable + } + return "" +} + +func (x *MsgEditToken) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +// MsgEditTokenResponse defines the Msg/EditToken response type +type MsgEditTokenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgEditTokenResponse) Reset() { + *x = MsgEditTokenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgEditTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgEditTokenResponse) ProtoMessage() {} + +// Deprecated: Use MsgEditTokenResponse.ProtoReflect.Descriptor instead. +func (*MsgEditTokenResponse) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{5} +} + +// MsgMintToken defines an SDK message for minting a new token +type MsgMintToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Coin *v1beta1.Coin `protobuf:"bytes,1,opt,name=coin,proto3" json:"coin,omitempty"` + Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"` + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (x *MsgMintToken) Reset() { + *x = MsgMintToken{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_tx_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgIssueToken) String() string { +func (x *MsgMintToken) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgIssueToken) ProtoMessage() {} +func (*MsgMintToken) ProtoMessage() {} -// Deprecated: Use MsgIssueToken.ProtoReflect.Descriptor instead. -func (*MsgIssueToken) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{0} +// Deprecated: Use MsgMintToken.ProtoReflect.Descriptor instead. +func (*MsgMintToken) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{6} } -func (x *MsgIssueToken) GetSymbol() string { +func (x *MsgMintToken) GetCoin() *v1beta1.Coin { if x != nil { - return x.Symbol + return x.Coin } - return "" + return nil } -func (x *MsgIssueToken) GetName() string { +func (x *MsgMintToken) GetReceiver() string { if x != nil { - return x.Name + return x.Receiver } return "" } -func (x *MsgIssueToken) GetScale() uint32 { +func (x *MsgMintToken) GetOwner() string { if x != nil { - return x.Scale + return x.Owner } - return 0 + return "" } -func (x *MsgIssueToken) GetMinUnit() string { - if x != nil { - return x.MinUnit - } - return "" +// MsgMintTokenResponse defines the Msg/MintToken response type +type MsgMintTokenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (x *MsgIssueToken) GetInitialSupply() uint64 { - if x != nil { - return x.InitialSupply +func (x *MsgMintTokenResponse) Reset() { + *x = MsgMintTokenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_tx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -func (x *MsgIssueToken) GetMaxSupply() uint64 { - if x != nil { - return x.MaxSupply +func (x *MsgMintTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgMintTokenResponse) ProtoMessage() {} + +// Deprecated: Use MsgMintTokenResponse.ProtoReflect.Descriptor instead. +func (*MsgMintTokenResponse) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{7} +} + +// MsgBurnToken defines an SDK message for burning some tokens +type MsgBurnToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Coin *v1beta1.Coin `protobuf:"bytes,1,opt,name=coin,proto3" json:"coin,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (x *MsgBurnToken) Reset() { + *x = MsgBurnToken{} + if protoimpl.UnsafeEnabled { + mi := &file_irismod_token_v1_tx_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -func (x *MsgIssueToken) GetMintable() bool { +func (x *MsgBurnToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgBurnToken) ProtoMessage() {} + +// Deprecated: Use MsgBurnToken.ProtoReflect.Descriptor instead. +func (*MsgBurnToken) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{8} +} + +func (x *MsgBurnToken) GetCoin() *v1beta1.Coin { if x != nil { - return x.Mintable + return x.Coin } - return false + return nil } -func (x *MsgIssueToken) GetOwner() string { +func (x *MsgBurnToken) GetSender() string { if x != nil { - return x.Owner + return x.Sender } return "" } -// MsgIssueTokenResponse defines the Msg/IssueToken response type -type MsgIssueTokenResponse struct { +// MsgBurnTokenResponse defines the Msg/BurnToken response type +type MsgBurnTokenResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *MsgIssueTokenResponse) Reset() { - *x = MsgIssueTokenResponse{} +func (x *MsgBurnTokenResponse) Reset() { + *x = MsgBurnTokenResponse{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[1] + mi := &file_irismod_token_v1_tx_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgIssueTokenResponse) String() string { +func (x *MsgBurnTokenResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgIssueTokenResponse) ProtoMessage() {} +func (*MsgBurnTokenResponse) ProtoMessage() {} -// Deprecated: Use MsgIssueTokenResponse.ProtoReflect.Descriptor instead. -func (*MsgIssueTokenResponse) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{1} +// Deprecated: Use MsgBurnTokenResponse.ProtoReflect.Descriptor instead. +func (*MsgBurnTokenResponse) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{9} } -// MsgTransferTokenOwner defines an SDK message for transferring the token owner -type MsgTransferTokenOwner struct { +// MsgSwapFeeToken defines an SDK message for swap fee token +type MsgSwapFeeToken struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SrcOwner string `protobuf:"bytes,1,opt,name=src_owner,json=srcOwner,proto3" json:"src_owner,omitempty"` - DstOwner string `protobuf:"bytes,2,opt,name=dst_owner,json=dstOwner,proto3" json:"dst_owner,omitempty"` - Symbol string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"` + FeePaid *v1beta1.Coin `protobuf:"bytes,1,opt,name=fee_paid,json=feePaid,proto3" json:"fee_paid,omitempty"` + Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"` + Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` } -func (x *MsgTransferTokenOwner) Reset() { - *x = MsgTransferTokenOwner{} +func (x *MsgSwapFeeToken) Reset() { + *x = MsgSwapFeeToken{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[2] + mi := &file_irismod_token_v1_tx_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgTransferTokenOwner) String() string { +func (x *MsgSwapFeeToken) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgTransferTokenOwner) ProtoMessage() {} +func (*MsgSwapFeeToken) ProtoMessage() {} -// Deprecated: Use MsgTransferTokenOwner.ProtoReflect.Descriptor instead. -func (*MsgTransferTokenOwner) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{2} +// Deprecated: Use MsgSwapFeeToken.ProtoReflect.Descriptor instead. +func (*MsgSwapFeeToken) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{10} } -func (x *MsgTransferTokenOwner) GetSrcOwner() string { +func (x *MsgSwapFeeToken) GetFeePaid() *v1beta1.Coin { if x != nil { - return x.SrcOwner + return x.FeePaid } - return "" + return nil } -func (x *MsgTransferTokenOwner) GetDstOwner() string { +func (x *MsgSwapFeeToken) GetReceiver() string { if x != nil { - return x.DstOwner + return x.Receiver } return "" } -func (x *MsgTransferTokenOwner) GetSymbol() string { +func (x *MsgSwapFeeToken) GetSender() string { if x != nil { - return x.Symbol + return x.Sender } return "" } -// MsgTransferTokenOwnerResponse defines the Msg/TransferTokenOwner response -// type -type MsgTransferTokenOwnerResponse struct { +// MsgSwapFeeTokenResponse defines the Msg/SwapFeeToken response type +type MsgSwapFeeTokenResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + FeeGot *v1beta1.Coin `protobuf:"bytes,1,opt,name=fee_got,json=feeGot,proto3" json:"fee_got,omitempty"` } -func (x *MsgTransferTokenOwnerResponse) Reset() { - *x = MsgTransferTokenOwnerResponse{} +func (x *MsgSwapFeeTokenResponse) Reset() { + *x = MsgSwapFeeTokenResponse{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[3] + mi := &file_irismod_token_v1_tx_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgTransferTokenOwnerResponse) String() string { +func (x *MsgSwapFeeTokenResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgTransferTokenOwnerResponse) ProtoMessage() {} +func (*MsgSwapFeeTokenResponse) ProtoMessage() {} -// Deprecated: Use MsgTransferTokenOwnerResponse.ProtoReflect.Descriptor instead. -func (*MsgTransferTokenOwnerResponse) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{3} +// Deprecated: Use MsgSwapFeeTokenResponse.ProtoReflect.Descriptor instead. +func (*MsgSwapFeeTokenResponse) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{11} } -// MsgEditToken defines an SDK message for editing a new token -type MsgEditToken struct { +func (x *MsgSwapFeeTokenResponse) GetFeeGot() *v1beta1.Coin { + if x != nil { + return x.FeeGot + } + return nil +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParams struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - MaxSupply uint64 `protobuf:"varint,3,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty"` - Mintable string `protobuf:"bytes,4,opt,name=mintable,proto3" json:"mintable,omitempty"` - Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` + // authority is the address that controls the module (defaults to token unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the token parameters to update. + // + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } -func (x *MsgEditToken) Reset() { - *x = MsgEditToken{} +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[4] + mi := &file_irismod_token_v1_tx_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgEditToken) String() string { +func (x *MsgUpdateParams) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgEditToken) ProtoMessage() {} - -// Deprecated: Use MsgEditToken.ProtoReflect.Descriptor instead. -func (*MsgEditToken) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{4} -} - -func (x *MsgEditToken) GetSymbol() string { - if x != nil { - return x.Symbol - } - return "" -} - -func (x *MsgEditToken) GetName() string { - if x != nil { - return x.Name - } - return "" -} +func (*MsgUpdateParams) ProtoMessage() {} -func (x *MsgEditToken) GetMaxSupply() uint64 { - if x != nil { - return x.MaxSupply - } - return 0 +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{12} } -func (x *MsgEditToken) GetMintable() string { +func (x *MsgUpdateParams) GetAuthority() string { if x != nil { - return x.Mintable + return x.Authority } return "" } -func (x *MsgEditToken) GetOwner() string { +func (x *MsgUpdateParams) GetParams() *Params { if x != nil { - return x.Owner + return x.Params } - return "" + return nil } -// MsgEditTokenResponse defines the Msg/EditToken response type -type MsgEditTokenResponse struct { +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } - -func (x *MsgEditTokenResponse) Reset() { - *x = MsgEditTokenResponse{} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[5] + mi := &file_irismod_token_v1_tx_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgEditTokenResponse) String() string { +func (x *MsgUpdateParamsResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgEditTokenResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) ProtoMessage() {} -// Deprecated: Use MsgEditTokenResponse.ProtoReflect.Descriptor instead. -func (*MsgEditTokenResponse) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{5} +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{13} } -// MsgMintToken defines an SDK message for minting a new token -type MsgMintToken struct { +// MsgDeployERC20 defines an SDK message for DeployERC20 +type MsgDeployERC20 struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Coin *v1beta1.Coin `protobuf:"bytes,1,opt,name=coin,proto3" json:"coin,omitempty"` - To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` - Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Scale uint32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"` + MinUnit string `protobuf:"bytes,4,opt,name=min_unit,json=minUnit,proto3" json:"min_unit,omitempty"` + Authority string `protobuf:"bytes,5,opt,name=authority,proto3" json:"authority,omitempty"` } -func (x *MsgMintToken) Reset() { - *x = MsgMintToken{} +func (x *MsgDeployERC20) Reset() { + *x = MsgDeployERC20{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[6] + mi := &file_irismod_token_v1_tx_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgMintToken) String() string { +func (x *MsgDeployERC20) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgMintToken) ProtoMessage() {} +func (*MsgDeployERC20) ProtoMessage() {} -// Deprecated: Use MsgMintToken.ProtoReflect.Descriptor instead. -func (*MsgMintToken) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{6} +// Deprecated: Use MsgDeployERC20.ProtoReflect.Descriptor instead. +func (*MsgDeployERC20) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{14} } -func (x *MsgMintToken) GetCoin() *v1beta1.Coin { +func (x *MsgDeployERC20) GetSymbol() string { if x != nil { - return x.Coin + return x.Symbol } - return nil + return "" } -func (x *MsgMintToken) GetTo() string { +func (x *MsgDeployERC20) GetName() string { if x != nil { - return x.To + return x.Name } return "" } -func (x *MsgMintToken) GetOwner() string { +func (x *MsgDeployERC20) GetScale() uint32 { if x != nil { - return x.Owner + return x.Scale + } + return 0 +} + +func (x *MsgDeployERC20) GetMinUnit() string { + if x != nil { + return x.MinUnit } return "" } -// MsgMintTokenResponse defines the Msg/MintToken response type -type MsgMintTokenResponse struct { +func (x *MsgDeployERC20) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +// MsgDeployERC20Response defines the Msg/DeployERC20 response type +type MsgDeployERC20Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *MsgMintTokenResponse) Reset() { - *x = MsgMintTokenResponse{} +func (x *MsgDeployERC20Response) Reset() { + *x = MsgDeployERC20Response{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[7] + mi := &file_irismod_token_v1_tx_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgMintTokenResponse) String() string { +func (x *MsgDeployERC20Response) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgMintTokenResponse) ProtoMessage() {} +func (*MsgDeployERC20Response) ProtoMessage() {} -// Deprecated: Use MsgMintTokenResponse.ProtoReflect.Descriptor instead. -func (*MsgMintTokenResponse) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{7} +// Deprecated: Use MsgDeployERC20Response.ProtoReflect.Descriptor instead. +func (*MsgDeployERC20Response) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{15} } -// MsgBurnToken defines an SDK message for burning some tokens -type MsgBurnToken struct { +// MsgSwapToERC20 defines an SDK message for SwapToERC20 +type MsgSwapToERC20 struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Coin *v1beta1.Coin `protobuf:"bytes,1,opt,name=coin,proto3" json:"coin,omitempty"` - Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Amount *v1beta1.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` } -func (x *MsgBurnToken) Reset() { - *x = MsgBurnToken{} +func (x *MsgSwapToERC20) Reset() { + *x = MsgSwapToERC20{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[8] + mi := &file_irismod_token_v1_tx_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgBurnToken) String() string { +func (x *MsgSwapToERC20) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgBurnToken) ProtoMessage() {} +func (*MsgSwapToERC20) ProtoMessage() {} -// Deprecated: Use MsgBurnToken.ProtoReflect.Descriptor instead. -func (*MsgBurnToken) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{8} +// Deprecated: Use MsgSwapToERC20.ProtoReflect.Descriptor instead. +func (*MsgSwapToERC20) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{16} } -func (x *MsgBurnToken) GetCoin() *v1beta1.Coin { +func (x *MsgSwapToERC20) GetAmount() *v1beta1.Coin { if x != nil { - return x.Coin + return x.Amount } return nil } -func (x *MsgBurnToken) GetSender() string { +func (x *MsgSwapToERC20) GetSender() string { if x != nil { return x.Sender } return "" } -// MsgBurnTokenResponse defines the Msg/BurnToken response type -type MsgBurnTokenResponse struct { +func (x *MsgSwapToERC20) GetReceiver() string { + if x != nil { + return x.Receiver + } + return "" +} + +// MsgSwapToERC20Response defines the Msg/SwapToERC20 response type +type MsgSwapToERC20Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *MsgBurnTokenResponse) Reset() { - *x = MsgBurnTokenResponse{} +func (x *MsgSwapToERC20Response) Reset() { + *x = MsgSwapToERC20Response{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[9] + mi := &file_irismod_token_v1_tx_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgBurnTokenResponse) String() string { +func (x *MsgSwapToERC20Response) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgBurnTokenResponse) ProtoMessage() {} +func (*MsgSwapToERC20Response) ProtoMessage() {} -// Deprecated: Use MsgBurnTokenResponse.ProtoReflect.Descriptor instead. -func (*MsgBurnTokenResponse) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{9} +// Deprecated: Use MsgSwapToERC20Response.ProtoReflect.Descriptor instead. +func (*MsgSwapToERC20Response) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{17} } -// MsgSwapFeeToken defines an SDK message for swap fee token -type MsgSwapFeeToken struct { +// MsgSwapFromERC20 defines an SDK message for SwapFromERC20 +type MsgSwapFromERC20 struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FeePaid *v1beta1.Coin `protobuf:"bytes,1,opt,name=fee_paid,json=feePaid,proto3" json:"fee_paid,omitempty"` - Recipient string `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` - Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` + WantedAmount *v1beta1.Coin `protobuf:"bytes,1,opt,name=wanted_amount,json=wantedAmount,proto3" json:"wanted_amount,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` } -func (x *MsgSwapFeeToken) Reset() { - *x = MsgSwapFeeToken{} +func (x *MsgSwapFromERC20) Reset() { + *x = MsgSwapFromERC20{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[10] + mi := &file_irismod_token_v1_tx_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgSwapFeeToken) String() string { +func (x *MsgSwapFromERC20) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgSwapFeeToken) ProtoMessage() {} +func (*MsgSwapFromERC20) ProtoMessage() {} -// Deprecated: Use MsgSwapFeeToken.ProtoReflect.Descriptor instead. -func (*MsgSwapFeeToken) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{10} +// Deprecated: Use MsgSwapFromERC20.ProtoReflect.Descriptor instead. +func (*MsgSwapFromERC20) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{18} } -func (x *MsgSwapFeeToken) GetFeePaid() *v1beta1.Coin { +func (x *MsgSwapFromERC20) GetWantedAmount() *v1beta1.Coin { if x != nil { - return x.FeePaid + return x.WantedAmount } return nil } -func (x *MsgSwapFeeToken) GetRecipient() string { +func (x *MsgSwapFromERC20) GetSender() string { if x != nil { - return x.Recipient + return x.Sender } return "" } -func (x *MsgSwapFeeToken) GetSender() string { +func (x *MsgSwapFromERC20) GetReceiver() string { if x != nil { - return x.Sender + return x.Receiver } return "" } -// MsgSwapFeeTokenResponse defines the Msg/SwapFeeToken response type -type MsgSwapFeeTokenResponse struct { +// MsgSwapFromERC20Response defines the Msg/SwapFromERC20 response type +type MsgSwapFromERC20Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - FeeGot *v1beta1.Coin `protobuf:"bytes,1,opt,name=fee_got,json=feeGot,proto3" json:"fee_got,omitempty"` } -func (x *MsgSwapFeeTokenResponse) Reset() { - *x = MsgSwapFeeTokenResponse{} +func (x *MsgSwapFromERC20Response) Reset() { + *x = MsgSwapFromERC20Response{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[11] + mi := &file_irismod_token_v1_tx_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgSwapFeeTokenResponse) String() string { +func (x *MsgSwapFromERC20Response) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgSwapFeeTokenResponse) ProtoMessage() {} - -// Deprecated: Use MsgSwapFeeTokenResponse.ProtoReflect.Descriptor instead. -func (*MsgSwapFeeTokenResponse) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{11} -} +func (*MsgSwapFromERC20Response) ProtoMessage() {} -func (x *MsgSwapFeeTokenResponse) GetFeeGot() *v1beta1.Coin { - if x != nil { - return x.FeeGot - } - return nil +// Deprecated: Use MsgSwapFromERC20Response.ProtoReflect.Descriptor instead. +func (*MsgSwapFromERC20Response) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{19} } -// MsgUpdateParams is the Msg/UpdateParams request type. -// -// Since: cosmos-sdk 0.47 -type MsgUpdateParams struct { +// MsgUpgradeERC20 defines an SDK message for UpgradeERC20 +type MsgUpgradeERC20 struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // authority is the address that controls the module (defaults to token unless - // overwritten). - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the token parameters to update. - // - // NOTE: All parameters must be supplied. - Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` + // implementation is the new erc20 contract address + Implementation string `protobuf:"bytes,1,opt,name=implementation,proto3" json:"implementation,omitempty"` + Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` } -func (x *MsgUpdateParams) Reset() { - *x = MsgUpdateParams{} +func (x *MsgUpgradeERC20) Reset() { + *x = MsgUpgradeERC20{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[12] + mi := &file_irismod_token_v1_tx_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgUpdateParams) String() string { +func (x *MsgUpgradeERC20) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpgradeERC20) ProtoMessage() {} -// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{12} +// Deprecated: Use MsgUpgradeERC20.ProtoReflect.Descriptor instead. +func (*MsgUpgradeERC20) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{20} } -func (x *MsgUpdateParams) GetAuthority() string { +func (x *MsgUpgradeERC20) GetImplementation() string { if x != nil { - return x.Authority + return x.Implementation } return "" } -func (x *MsgUpdateParams) GetParams() *Params { +func (x *MsgUpgradeERC20) GetAuthority() string { if x != nil { - return x.Params + return x.Authority } - return nil + return "" } -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: cosmos-sdk 0.47 -type MsgUpdateParamsResponse struct { +// MsgUpgradeERC20Response defines the Msg/UpgradeERC20 response type +type MsgUpgradeERC20Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *MsgUpdateParamsResponse) Reset() { - *x = MsgUpdateParamsResponse{} +func (x *MsgUpgradeERC20Response) Reset() { + *x = MsgUpgradeERC20Response{} if protoimpl.UnsafeEnabled { - mi := &file_irismod_token_v1_tx_proto_msgTypes[13] + mi := &file_irismod_token_v1_tx_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgUpdateParamsResponse) String() string { +func (x *MsgUpgradeERC20Response) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpgradeERC20Response) ProtoMessage() {} -// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{13} +// Deprecated: Use MsgUpgradeERC20Response.ProtoReflect.Descriptor instead. +func (*MsgUpgradeERC20Response) Descriptor() ([]byte, []int) { + return file_irismod_token_v1_tx_proto_rawDescGZIP(), []int{21} } var File_irismod_token_v1_tx_proto protoreflect.FileDescriptor @@ -7415,108 +11434,181 @@ var file_irismod_token_v1_tx_proto_rawDesc = []byte{ 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x0c, 0x4d, 0x73, 0x67, 0x4d, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x0c, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, - 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x04, 0x63, 0x6f, 0x69, 0x6e, 0x12, 0x0e, 0x0a, - 0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x6f, 0x12, 0x2e, 0x0a, - 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x3a, 0x0a, 0x82, - 0xe7, 0xb0, 0x2a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x4d, 0x73, 0x67, - 0x4d, 0x69, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x82, 0x01, 0x0a, 0x0c, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x04, 0x63, 0x6f, 0x69, 0x6e, 0x12, 0x1a, 0x0a, + 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x82, 0x01, + 0x0a, 0x0c, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, + 0x0a, 0x04, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x04, 0x63, + 0x6f, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa8, 0x01, 0x0a, 0x0f, 0x4d, + 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3a, + 0x0a, 0x08, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x61, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, - 0x00, 0x52, 0x04, 0x63, 0x6f, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, + 0x00, 0x52, 0x07, 0x66, 0x65, 0x65, 0x50, 0x61, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, + 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, + 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x53, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, + 0x46, 0x65, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x38, 0x0a, 0x07, 0x66, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, + 0x1f, 0x00, 0x52, 0x06, 0x66, 0x65, 0x65, 0x47, 0x6f, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x0f, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, + 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x0e, + 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x19, + 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa5, 0x01, 0x0a, 0x0e, 0x4d, 0x73, + 0x67, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x45, 0x52, 0x43, 0x32, 0x30, 0x12, 0x16, 0x0a, 0x06, + 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, + 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x61, 0x6c, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x19, + 0x0a, 0x08, 0x6d, 0x69, 0x6e, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, + 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x45, 0x52, + 0x43, 0x32, 0x30, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa4, 0x01, 0x0a, 0x0e, + 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x54, 0x6f, 0x45, 0x52, 0x43, 0x32, 0x30, 0x12, 0x37, + 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, - 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, - 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xaa, - 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x12, 0x3a, 0x0a, 0x08, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x61, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, - 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, - 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x66, 0x65, 0x65, 0x50, 0x61, 0x69, 0x64, 0x12, 0x1c, - 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, - 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x3a, 0x0b, - 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x53, 0x0a, 0x17, 0x4d, - 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x66, 0x65, 0x65, 0x5f, 0x67, 0x6f, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, - 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x66, 0x65, 0x65, 0x47, 0x6f, 0x74, - 0x22, 0x91, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x67, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x72, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x54, 0x6f, 0x45, + 0x52, 0x43, 0x32, 0x30, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xcd, 0x01, 0x0a, + 0x10, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x46, 0x72, 0x6f, 0x6d, 0x45, 0x52, 0x43, 0x32, + 0x30, 0x12, 0x44, 0x0a, 0x0d, 0x77, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, + 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x77, 0x61, 0x6e, 0x74, 0x65, + 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x36, 0x0a, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x69, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x74, 0x79, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, - 0x8f, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x56, 0x0a, 0x0a, 0x49, 0x73, 0x73, 0x75, 0x65, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1f, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x73, 0x73, 0x75, - 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x27, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x73, 0x73, - 0x75, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x53, 0x0a, 0x09, 0x45, 0x64, 0x69, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x2e, 0x69, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x26, 0x2e, 0x69, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x09, 0x4d, 0x69, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x12, 0x1e, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x1a, 0x26, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x09, 0x42, 0x75, 0x72, - 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, - 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x26, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, - 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, - 0x0a, 0x12, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, - 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x66, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x1a, 0x2f, 0x2e, + 0x67, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x3a, + 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x1a, 0x0a, 0x18, + 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x46, 0x72, 0x6f, 0x6d, 0x45, 0x52, 0x43, 0x32, 0x30, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x81, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x45, 0x52, 0x43, 0x32, 0x30, 0x12, 0x26, 0x0a, 0x0e, + 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x0e, 0x82, 0xe7, + 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x19, 0x0a, 0x17, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x45, 0x52, 0x43, 0x32, 0x30, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x84, 0x08, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x56, 0x0a, 0x0a, 0x49, 0x73, 0x73, 0x75, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1f, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, - 0x0a, 0x0c, 0x53, 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, + 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x73, 0x73, 0x75, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x27, + 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x73, 0x73, 0x75, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x09, 0x45, 0x64, 0x69, 0x74, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x26, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x64, 0x69, 0x74, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x09, + 0x4d, 0x69, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x2e, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x4d, 0x69, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x26, 0x2e, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x4d, 0x69, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x53, 0x0a, 0x09, 0x42, 0x75, 0x72, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x1a, 0x29, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0c, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x69, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x26, + 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x72, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, 0x12, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x27, 0x2e, 0x69, + 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x1a, 0x2f, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0c, 0x53, 0x77, 0x61, 0x70, 0x46, 0x65, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, + 0x70, 0x46, 0x65, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x29, 0x2e, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x53, 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x53, 0x77, 0x61, 0x70, 0x54, 0x6f, 0x45, 0x52, + 0x43, 0x32, 0x30, 0x12, 0x20, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x54, 0x6f, + 0x45, 0x52, 0x43, 0x32, 0x30, 0x1a, 0x28, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, + 0x54, 0x6f, 0x45, 0x52, 0x43, 0x32, 0x30, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x5f, 0x0a, 0x0d, 0x53, 0x77, 0x61, 0x70, 0x46, 0x72, 0x6f, 0x6d, 0x45, 0x52, 0x43, 0x32, 0x30, + 0x12, 0x22, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x46, 0x72, 0x6f, 0x6d, 0x45, + 0x52, 0x43, 0x32, 0x30, 0x1a, 0x2a, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x46, + 0x72, 0x6f, 0x6d, 0x45, 0x52, 0x43, 0x32, 0x30, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x21, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, + 0x0a, 0x0b, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x45, 0x52, 0x43, 0x32, 0x30, 0x12, 0x20, 0x2e, + 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x45, 0x52, 0x43, 0x32, 0x30, 0x1a, + 0x28, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x45, 0x52, 0x43, 0x32, + 0x30, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x67, + 0x72, 0x61, 0x64, 0x65, 0x45, 0x52, 0x43, 0x32, 0x30, 0x12, 0x21, 0x2e, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x45, 0x52, 0x43, 0x32, 0x30, 0x1a, 0x29, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, - 0x29, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, - 0x01, 0x42, 0xbe, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x76, 0x31, 0xa2, 0x02, - 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x49, 0x72, 0x69, - 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x49, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0xc8, 0xe1, - 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x45, 0x52, 0x43, 0x32, 0x30, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xbe, + 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, + 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, + 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x76, 0x31, 0xa2, + 0x02, 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, + 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x49, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x49, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -7531,7 +11623,7 @@ func file_irismod_token_v1_tx_proto_rawDescGZIP() []byte { return file_irismod_token_v1_tx_proto_rawDescData } -var file_irismod_token_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_irismod_token_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_irismod_token_v1_tx_proto_goTypes = []interface{}{ (*MsgIssueToken)(nil), // 0: irismod.token.v1.MsgIssueToken (*MsgIssueTokenResponse)(nil), // 1: irismod.token.v1.MsgIssueTokenResponse @@ -7547,34 +11639,52 @@ var file_irismod_token_v1_tx_proto_goTypes = []interface{}{ (*MsgSwapFeeTokenResponse)(nil), // 11: irismod.token.v1.MsgSwapFeeTokenResponse (*MsgUpdateParams)(nil), // 12: irismod.token.v1.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 13: irismod.token.v1.MsgUpdateParamsResponse - (*v1beta1.Coin)(nil), // 14: cosmos.base.v1beta1.Coin - (*Params)(nil), // 15: irismod.token.v1.Params + (*MsgDeployERC20)(nil), // 14: irismod.token.v1.MsgDeployERC20 + (*MsgDeployERC20Response)(nil), // 15: irismod.token.v1.MsgDeployERC20Response + (*MsgSwapToERC20)(nil), // 16: irismod.token.v1.MsgSwapToERC20 + (*MsgSwapToERC20Response)(nil), // 17: irismod.token.v1.MsgSwapToERC20Response + (*MsgSwapFromERC20)(nil), // 18: irismod.token.v1.MsgSwapFromERC20 + (*MsgSwapFromERC20Response)(nil), // 19: irismod.token.v1.MsgSwapFromERC20Response + (*MsgUpgradeERC20)(nil), // 20: irismod.token.v1.MsgUpgradeERC20 + (*MsgUpgradeERC20Response)(nil), // 21: irismod.token.v1.MsgUpgradeERC20Response + (*v1beta1.Coin)(nil), // 22: cosmos.base.v1beta1.Coin + (*Params)(nil), // 23: irismod.token.v1.Params } var file_irismod_token_v1_tx_proto_depIdxs = []int32{ - 14, // 0: irismod.token.v1.MsgMintToken.coin:type_name -> cosmos.base.v1beta1.Coin - 14, // 1: irismod.token.v1.MsgBurnToken.coin:type_name -> cosmos.base.v1beta1.Coin - 14, // 2: irismod.token.v1.MsgSwapFeeToken.fee_paid:type_name -> cosmos.base.v1beta1.Coin - 14, // 3: irismod.token.v1.MsgSwapFeeTokenResponse.fee_got:type_name -> cosmos.base.v1beta1.Coin - 15, // 4: irismod.token.v1.MsgUpdateParams.params:type_name -> irismod.token.v1.Params - 0, // 5: irismod.token.v1.Msg.IssueToken:input_type -> irismod.token.v1.MsgIssueToken - 4, // 6: irismod.token.v1.Msg.EditToken:input_type -> irismod.token.v1.MsgEditToken - 6, // 7: irismod.token.v1.Msg.MintToken:input_type -> irismod.token.v1.MsgMintToken - 8, // 8: irismod.token.v1.Msg.BurnToken:input_type -> irismod.token.v1.MsgBurnToken - 2, // 9: irismod.token.v1.Msg.TransferTokenOwner:input_type -> irismod.token.v1.MsgTransferTokenOwner - 10, // 10: irismod.token.v1.Msg.SwapFeeToken:input_type -> irismod.token.v1.MsgSwapFeeToken - 12, // 11: irismod.token.v1.Msg.UpdateParams:input_type -> irismod.token.v1.MsgUpdateParams - 1, // 12: irismod.token.v1.Msg.IssueToken:output_type -> irismod.token.v1.MsgIssueTokenResponse - 5, // 13: irismod.token.v1.Msg.EditToken:output_type -> irismod.token.v1.MsgEditTokenResponse - 7, // 14: irismod.token.v1.Msg.MintToken:output_type -> irismod.token.v1.MsgMintTokenResponse - 9, // 15: irismod.token.v1.Msg.BurnToken:output_type -> irismod.token.v1.MsgBurnTokenResponse - 3, // 16: irismod.token.v1.Msg.TransferTokenOwner:output_type -> irismod.token.v1.MsgTransferTokenOwnerResponse - 11, // 17: irismod.token.v1.Msg.SwapFeeToken:output_type -> irismod.token.v1.MsgSwapFeeTokenResponse - 13, // 18: irismod.token.v1.Msg.UpdateParams:output_type -> irismod.token.v1.MsgUpdateParamsResponse - 12, // [12:19] is the sub-list for method output_type - 5, // [5:12] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 22, // 0: irismod.token.v1.MsgMintToken.coin:type_name -> cosmos.base.v1beta1.Coin + 22, // 1: irismod.token.v1.MsgBurnToken.coin:type_name -> cosmos.base.v1beta1.Coin + 22, // 2: irismod.token.v1.MsgSwapFeeToken.fee_paid:type_name -> cosmos.base.v1beta1.Coin + 22, // 3: irismod.token.v1.MsgSwapFeeTokenResponse.fee_got:type_name -> cosmos.base.v1beta1.Coin + 23, // 4: irismod.token.v1.MsgUpdateParams.params:type_name -> irismod.token.v1.Params + 22, // 5: irismod.token.v1.MsgSwapToERC20.amount:type_name -> cosmos.base.v1beta1.Coin + 22, // 6: irismod.token.v1.MsgSwapFromERC20.wanted_amount:type_name -> cosmos.base.v1beta1.Coin + 0, // 7: irismod.token.v1.Msg.IssueToken:input_type -> irismod.token.v1.MsgIssueToken + 4, // 8: irismod.token.v1.Msg.EditToken:input_type -> irismod.token.v1.MsgEditToken + 6, // 9: irismod.token.v1.Msg.MintToken:input_type -> irismod.token.v1.MsgMintToken + 8, // 10: irismod.token.v1.Msg.BurnToken:input_type -> irismod.token.v1.MsgBurnToken + 2, // 11: irismod.token.v1.Msg.TransferTokenOwner:input_type -> irismod.token.v1.MsgTransferTokenOwner + 10, // 12: irismod.token.v1.Msg.SwapFeeToken:input_type -> irismod.token.v1.MsgSwapFeeToken + 16, // 13: irismod.token.v1.Msg.SwapToERC20:input_type -> irismod.token.v1.MsgSwapToERC20 + 18, // 14: irismod.token.v1.Msg.SwapFromERC20:input_type -> irismod.token.v1.MsgSwapFromERC20 + 12, // 15: irismod.token.v1.Msg.UpdateParams:input_type -> irismod.token.v1.MsgUpdateParams + 14, // 16: irismod.token.v1.Msg.DeployERC20:input_type -> irismod.token.v1.MsgDeployERC20 + 20, // 17: irismod.token.v1.Msg.UpgradeERC20:input_type -> irismod.token.v1.MsgUpgradeERC20 + 1, // 18: irismod.token.v1.Msg.IssueToken:output_type -> irismod.token.v1.MsgIssueTokenResponse + 5, // 19: irismod.token.v1.Msg.EditToken:output_type -> irismod.token.v1.MsgEditTokenResponse + 7, // 20: irismod.token.v1.Msg.MintToken:output_type -> irismod.token.v1.MsgMintTokenResponse + 9, // 21: irismod.token.v1.Msg.BurnToken:output_type -> irismod.token.v1.MsgBurnTokenResponse + 3, // 22: irismod.token.v1.Msg.TransferTokenOwner:output_type -> irismod.token.v1.MsgTransferTokenOwnerResponse + 11, // 23: irismod.token.v1.Msg.SwapFeeToken:output_type -> irismod.token.v1.MsgSwapFeeTokenResponse + 17, // 24: irismod.token.v1.Msg.SwapToERC20:output_type -> irismod.token.v1.MsgSwapToERC20Response + 19, // 25: irismod.token.v1.Msg.SwapFromERC20:output_type -> irismod.token.v1.MsgSwapFromERC20Response + 13, // 26: irismod.token.v1.Msg.UpdateParams:output_type -> irismod.token.v1.MsgUpdateParamsResponse + 15, // 27: irismod.token.v1.Msg.DeployERC20:output_type -> irismod.token.v1.MsgDeployERC20Response + 21, // 28: irismod.token.v1.Msg.UpgradeERC20:output_type -> irismod.token.v1.MsgUpgradeERC20Response + 18, // [18:29] is the sub-list for method output_type + 7, // [7:18] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_irismod_token_v1_tx_proto_init() } @@ -7752,6 +11862,102 @@ func file_irismod_token_v1_tx_proto_init() { return nil } } + file_irismod_token_v1_tx_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgDeployERC20); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_irismod_token_v1_tx_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgDeployERC20Response); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_irismod_token_v1_tx_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSwapToERC20); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_irismod_token_v1_tx_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSwapToERC20Response); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_irismod_token_v1_tx_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSwapFromERC20); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_irismod_token_v1_tx_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSwapFromERC20Response); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_irismod_token_v1_tx_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpgradeERC20); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_irismod_token_v1_tx_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpgradeERC20Response); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -7759,7 +11965,7 @@ func file_irismod_token_v1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_irismod_token_v1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 22, NumExtensions: 0, NumServices: 1, }, diff --git a/api/irismod/token/v1/tx_grpc.pb.go b/api/irismod/token/v1/tx_grpc.pb.go index c5f859c6..298b17bc 100644 --- a/api/irismod/token/v1/tx_grpc.pb.go +++ b/api/irismod/token/v1/tx_grpc.pb.go @@ -25,7 +25,11 @@ const ( Msg_BurnToken_FullMethodName = "/irismod.token.v1.Msg/BurnToken" Msg_TransferTokenOwner_FullMethodName = "/irismod.token.v1.Msg/TransferTokenOwner" Msg_SwapFeeToken_FullMethodName = "/irismod.token.v1.Msg/SwapFeeToken" + Msg_SwapToERC20_FullMethodName = "/irismod.token.v1.Msg/SwapToERC20" + Msg_SwapFromERC20_FullMethodName = "/irismod.token.v1.Msg/SwapFromERC20" Msg_UpdateParams_FullMethodName = "/irismod.token.v1.Msg/UpdateParams" + Msg_DeployERC20_FullMethodName = "/irismod.token.v1.Msg/DeployERC20" + Msg_UpgradeERC20_FullMethodName = "/irismod.token.v1.Msg/UpgradeERC20" ) // MsgClient is the client API for Msg service. @@ -42,13 +46,24 @@ type MsgClient interface { BurnToken(ctx context.Context, in *MsgBurnToken, opts ...grpc.CallOption) (*MsgBurnTokenResponse, error) // TransferTokenOwner defines a method for transfering token owner TransferTokenOwner(ctx context.Context, in *MsgTransferTokenOwner, opts ...grpc.CallOption) (*MsgTransferTokenOwnerResponse, error) - // SwapFeeToken defines a method for swap some fee token + // SwapFeeToken defines a method for swapping between IRIS and ERIS SwapFeeToken(ctx context.Context, in *MsgSwapFeeToken, opts ...grpc.CallOption) (*MsgSwapFeeTokenResponse, error) + // SwapToERC20 defines a method for swapping some native token to its ERC20 + // counterpart + SwapToERC20(ctx context.Context, in *MsgSwapToERC20, opts ...grpc.CallOption) (*MsgSwapToERC20Response, error) + // SwapFromERC20 defines a method for swapping some ERC20 token to its native + // counterpart + SwapFromERC20(ctx context.Context, in *MsgSwapFromERC20, opts ...grpc.CallOption) (*MsgSwapFromERC20Response, error) // UpdateParams defines a governance operation for updating the token // module parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // DeployERC20 defines a governance operation for deploying an ERC20 contract + // that binds to a native token + DeployERC20(ctx context.Context, in *MsgDeployERC20, opts ...grpc.CallOption) (*MsgDeployERC20Response, error) + // UpgradeERC20 defines a governance operation for upgrading an ERC20 contract + UpgradeERC20(ctx context.Context, in *MsgUpgradeERC20, opts ...grpc.CallOption) (*MsgUpgradeERC20Response, error) } type msgClient struct { @@ -113,6 +128,24 @@ func (c *msgClient) SwapFeeToken(ctx context.Context, in *MsgSwapFeeToken, opts return out, nil } +func (c *msgClient) SwapToERC20(ctx context.Context, in *MsgSwapToERC20, opts ...grpc.CallOption) (*MsgSwapToERC20Response, error) { + out := new(MsgSwapToERC20Response) + err := c.cc.Invoke(ctx, Msg_SwapToERC20_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SwapFromERC20(ctx context.Context, in *MsgSwapFromERC20, opts ...grpc.CallOption) (*MsgSwapFromERC20Response, error) { + out := new(MsgSwapFromERC20Response) + err := c.cc.Invoke(ctx, Msg_SwapFromERC20_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { out := new(MsgUpdateParamsResponse) err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...) @@ -122,6 +155,24 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) DeployERC20(ctx context.Context, in *MsgDeployERC20, opts ...grpc.CallOption) (*MsgDeployERC20Response, error) { + out := new(MsgDeployERC20Response) + err := c.cc.Invoke(ctx, Msg_DeployERC20_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpgradeERC20(ctx context.Context, in *MsgUpgradeERC20, opts ...grpc.CallOption) (*MsgUpgradeERC20Response, error) { + out := new(MsgUpgradeERC20Response) + err := c.cc.Invoke(ctx, Msg_UpgradeERC20_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -136,13 +187,24 @@ type MsgServer interface { BurnToken(context.Context, *MsgBurnToken) (*MsgBurnTokenResponse, error) // TransferTokenOwner defines a method for transfering token owner TransferTokenOwner(context.Context, *MsgTransferTokenOwner) (*MsgTransferTokenOwnerResponse, error) - // SwapFeeToken defines a method for swap some fee token + // SwapFeeToken defines a method for swapping between IRIS and ERIS SwapFeeToken(context.Context, *MsgSwapFeeToken) (*MsgSwapFeeTokenResponse, error) + // SwapToERC20 defines a method for swapping some native token to its ERC20 + // counterpart + SwapToERC20(context.Context, *MsgSwapToERC20) (*MsgSwapToERC20Response, error) + // SwapFromERC20 defines a method for swapping some ERC20 token to its native + // counterpart + SwapFromERC20(context.Context, *MsgSwapFromERC20) (*MsgSwapFromERC20Response, error) // UpdateParams defines a governance operation for updating the token // module parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // DeployERC20 defines a governance operation for deploying an ERC20 contract + // that binds to a native token + DeployERC20(context.Context, *MsgDeployERC20) (*MsgDeployERC20Response, error) + // UpgradeERC20 defines a governance operation for upgrading an ERC20 contract + UpgradeERC20(context.Context, *MsgUpgradeERC20) (*MsgUpgradeERC20Response, error) mustEmbedUnimplementedMsgServer() } @@ -168,9 +230,21 @@ func (UnimplementedMsgServer) TransferTokenOwner(context.Context, *MsgTransferTo func (UnimplementedMsgServer) SwapFeeToken(context.Context, *MsgSwapFeeToken) (*MsgSwapFeeTokenResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SwapFeeToken not implemented") } +func (UnimplementedMsgServer) SwapToERC20(context.Context, *MsgSwapToERC20) (*MsgSwapToERC20Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapToERC20 not implemented") +} +func (UnimplementedMsgServer) SwapFromERC20(context.Context, *MsgSwapFromERC20) (*MsgSwapFromERC20Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapFromERC20 not implemented") +} func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (UnimplementedMsgServer) DeployERC20(context.Context, *MsgDeployERC20) (*MsgDeployERC20Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeployERC20 not implemented") +} +func (UnimplementedMsgServer) UpgradeERC20(context.Context, *MsgUpgradeERC20) (*MsgUpgradeERC20Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeERC20 not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -292,6 +366,42 @@ func _Msg_SwapFeeToken_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_SwapToERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwapToERC20) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SwapToERC20(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_SwapToERC20_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SwapToERC20(ctx, req.(*MsgSwapToERC20)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SwapFromERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwapFromERC20) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SwapFromERC20(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_SwapFromERC20_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SwapFromERC20(ctx, req.(*MsgSwapFromERC20)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateParams) if err := dec(in); err != nil { @@ -310,6 +420,42 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_DeployERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeployERC20) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DeployERC20(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_DeployERC20_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DeployERC20(ctx, req.(*MsgDeployERC20)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpgradeERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpgradeERC20) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpgradeERC20(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_UpgradeERC20_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpgradeERC20(ctx, req.(*MsgUpgradeERC20)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -341,10 +487,26 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "SwapFeeToken", Handler: _Msg_SwapFeeToken_Handler, }, + { + MethodName: "SwapToERC20", + Handler: _Msg_SwapToERC20_Handler, + }, + { + MethodName: "SwapFromERC20", + Handler: _Msg_SwapFromERC20_Handler, + }, { MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "DeployERC20", + Handler: _Msg_DeployERC20_Handler, + }, + { + MethodName: "UpgradeERC20", + Handler: _Msg_UpgradeERC20_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "irismod/token/v1/tx.proto", diff --git a/api/irismod/token/v1beta1/token.pulsar.go b/api/irismod/token/v1beta1/token.pulsar.go index 340a78dd..4a9797eb 100644 --- a/api/irismod/token/v1beta1/token.pulsar.go +++ b/api/irismod/token/v1beta1/token.pulsar.go @@ -1596,17 +1596,17 @@ var file_irismod_token_v1beta1_token_proto_rawDesc = []byte{ 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x22, 0x52, 0x11, 0x6d, 0x69, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x3a, 0x08, 0x98, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xae, 0x01, - 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x42, 0x0a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, - 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, 0x0d, - 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0xca, 0x02, 0x0d, - 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0xe2, 0x02, 0x19, - 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x49, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, + 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x0a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x54, + 0x58, 0xaa, 0x02, 0x0d, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0xca, 0x02, 0x0d, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0xe2, 0x02, 0x19, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, + 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/api/irismod/token/v1beta1/tx.pulsar.go b/api/irismod/token/v1beta1/tx.pulsar.go index d8bbc676..adc895fe 100644 --- a/api/irismod/token/v1beta1/tx.pulsar.go +++ b/api/irismod/token/v1beta1/tx.pulsar.go @@ -5508,18 +5508,18 @@ var file_irismod_token_v1beta1_tx_proto_rawDesc = []byte{ 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x1a, 0x2c, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x77, 0x6e, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xab, 0x01, 0x0a, 0x11, 0x63, - 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, - 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xa2, 0x02, 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, 0x0d, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0xca, 0x02, 0x0d, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0xe2, 0x02, 0x19, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, - 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xab, 0x01, 0xc8, 0xe1, 0x1e, + 0x00, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, + 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, 0x0d, 0x49, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0xca, 0x02, 0x0d, 0x49, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0xe2, 0x02, 0x19, 0x49, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, + 0x64, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/contracts/ERC20.sol b/contracts/ERC20.sol new file mode 100644 index 00000000..395e63e2 --- /dev/null +++ b/contracts/ERC20.sol @@ -0,0 +1,315 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; +import {Context} from "@openzeppelin/contracts/utils/Context.sol"; +import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; + +/** + * @dev Implementation of the {IERC20} interface. + * + * This implementation is agnostic to the way tokens are created. This means + * that a supply mechanism has to be added in a derived contract using {_mint}. + * + * TIP: For a detailed writeup see our guide + * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How + * to implement supply mechanisms]. + * + * The default value of {decimals} is 18. To change this, you should override + * this function so it returns a different value. + * + * We have followed general OpenZeppelin Contracts guidelines: functions revert + * instead returning `false` on failure. This behavior is nonetheless + * conventional and does not conflict with the expectations of ERC20 + * applications. + * + * Additionally, an {Approval} event is emitted on calls to {transferFrom}. + * This allows applications to reconstruct the allowance for all accounts just + * by listening to said events. Other implementations of the EIP may not emit + * these events, as it isn't required by the specification. + */ +abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { + mapping(address account => uint256) private _balances; + + mapping(address account => mapping(address spender => uint256)) private _allowances; + + uint256 private _totalSupply; + + string internal _name; + string internal _symbol; + + /** + * @dev Sets the values for {name} and {symbol}. + * + * All two of these values are immutable: they can only be set once during + * construction. + */ + constructor(string memory name_, string memory symbol_) { + _name = name_; + _symbol = symbol_; + } + + + /** + * @dev Returns the name of the token. + */ + function name() public view virtual returns (string memory) { + return _name; + } + + /** + * @dev Returns the symbol of the token, usually a shorter version of the + * name. + */ + function symbol() public view virtual returns (string memory) { + return _symbol; + } + + /** + * @dev Returns the number of decimals used to get its user representation. + * For example, if `decimals` equals `2`, a balance of `505` tokens should + * be displayed to a user as `5.05` (`505 / 10 ** 2`). + * + * Tokens usually opt for a value of 18, imitating the relationship between + * Ether and Wei. This is the default value returned by this function, unless + * it's overridden. + * + * NOTE: This information is only used for _display_ purposes: it in + * no way affects any of the arithmetic of the contract, including + * {IERC20-balanceOf} and {IERC20-transfer}. + */ + function decimals() public view virtual returns (uint8) { + return 18; + } + + /** + * @dev See {IERC20-totalSupply}. + */ + function totalSupply() public view virtual returns (uint256) { + return _totalSupply; + } + + /** + * @dev See {IERC20-balanceOf}. + */ + function balanceOf(address account) public view virtual returns (uint256) { + return _balances[account]; + } + + /** + * @dev See {IERC20-transfer}. + * + * Requirements: + * + * - `to` cannot be the zero address. + * - the caller must have a balance of at least `value`. + */ + function transfer(address to, uint256 value) public virtual returns (bool) { + address owner = _msgSender(); + _transfer(owner, to, value); + return true; + } + + /** + * @dev See {IERC20-allowance}. + */ + function allowance(address owner, address spender) public view virtual returns (uint256) { + return _allowances[owner][spender]; + } + + /** + * @dev See {IERC20-approve}. + * + * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on + * `transferFrom`. This is semantically equivalent to an infinite approval. + * + * Requirements: + * + * - `spender` cannot be the zero address. + */ + function approve(address spender, uint256 value) public virtual returns (bool) { + address owner = _msgSender(); + _approve(owner, spender, value); + return true; + } + + /** + * @dev See {IERC20-transferFrom}. + * + * Emits an {Approval} event indicating the updated allowance. This is not + * required by the EIP. See the note at the beginning of {ERC20}. + * + * NOTE: Does not update the allowance if the current allowance + * is the maximum `uint256`. + * + * Requirements: + * + * - `from` and `to` cannot be the zero address. + * - `from` must have a balance of at least `value`. + * - the caller must have allowance for ``from``'s tokens of at least + * `value`. + */ + function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { + address spender = _msgSender(); + _spendAllowance(from, spender, value); + _transfer(from, to, value); + return true; + } + + /** + * @dev Moves a `value` amount of tokens from `from` to `to`. + * + * This internal function is equivalent to {transfer}, and can be used to + * e.g. implement automatic token fees, slashing mechanisms, etc. + * + * Emits a {Transfer} event. + * + * NOTE: This function is not virtual, {_update} should be overridden instead. + */ + function _transfer(address from, address to, uint256 value) internal { + if (from == address(0)) { + revert ERC20InvalidSender(address(0)); + } + if (to == address(0)) { + revert ERC20InvalidReceiver(address(0)); + } + _update(from, to, value); + } + + /** + * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` + * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding + * this function. + * + * Emits a {Transfer} event. + */ + function _update(address from, address to, uint256 value) internal virtual { + if (from == address(0)) { + // Overflow check required: The rest of the code assumes that totalSupply never overflows + _totalSupply += value; + } else { + uint256 fromBalance = _balances[from]; + if (fromBalance < value) { + revert ERC20InsufficientBalance(from, fromBalance, value); + } + unchecked { + // Overflow not possible: value <= fromBalance <= totalSupply. + _balances[from] = fromBalance - value; + } + } + + if (to == address(0)) { + unchecked { + // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. + _totalSupply -= value; + } + } else { + unchecked { + // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. + _balances[to] += value; + } + } + + emit Transfer(from, to, value); + } + + /** + * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). + * Relies on the `_update` mechanism + * + * Emits a {Transfer} event with `from` set to the zero address. + * + * NOTE: This function is not virtual, {_update} should be overridden instead. + */ + function _mint(address account, uint256 value) internal { + if (account == address(0)) { + revert ERC20InvalidReceiver(address(0)); + } + _update(address(0), account, value); + } + + /** + * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. + * Relies on the `_update` mechanism. + * + * Emits a {Transfer} event with `to` set to the zero address. + * + * NOTE: This function is not virtual, {_update} should be overridden instead + */ + function _burn(address account, uint256 value) internal { + if (account == address(0)) { + revert ERC20InvalidSender(address(0)); + } + _update(account, address(0), value); + } + + /** + * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. + * + * This internal function is equivalent to `approve`, and can be used to + * e.g. set automatic allowances for certain subsystems, etc. + * + * Emits an {Approval} event. + * + * Requirements: + * + * - `owner` cannot be the zero address. + * - `spender` cannot be the zero address. + * + * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. + */ + function _approve(address owner, address spender, uint256 value) internal { + _approve(owner, spender, value, true); + } + + /** + * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. + * + * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by + * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any + * `Approval` event during `transferFrom` operations. + * + * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to + * true using the following override: + * ``` + * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { + * super._approve(owner, spender, value, true); + * } + * ``` + * + * Requirements are the same as {_approve}. + */ + function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { + if (owner == address(0)) { + revert ERC20InvalidApprover(address(0)); + } + if (spender == address(0)) { + revert ERC20InvalidSpender(address(0)); + } + _allowances[owner][spender] = value; + if (emitEvent) { + emit Approval(owner, spender, value); + } + } + + /** + * @dev Updates `owner` s allowance for `spender` based on spent `value`. + * + * Does not update the allowance value in case of infinite allowance. + * Revert if not enough allowance is available. + * + * Does not emit an {Approval} event. + */ + function _spendAllowance(address owner, address spender, uint256 value) internal virtual { + uint256 currentAllowance = allowance(owner, spender); + if (currentAllowance != type(uint256).max) { + if (currentAllowance < value) { + revert ERC20InsufficientAllowance(spender, currentAllowance, value); + } + unchecked { + _approve(owner, spender, currentAllowance - value, false); + } + } + } +} \ No newline at end of file diff --git a/contracts/MockTokenV2.sol b/contracts/MockTokenV2.sol new file mode 100644 index 00000000..b4064e4a --- /dev/null +++ b/contracts/MockTokenV2.sol @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "./ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; +import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; + +contract MockTokenV2 is ERC20, Ownable, ReentrancyGuard, Initializable, ERC165 { + event SwapToNative(address from, string to, uint256 amount); + + uint8 private _scale; + uint8 public constant VERSION = 2; + + constructor( + string memory name_, + string memory symbol_, + uint8 scale_ + ) ERC20(name_, symbol_) Ownable(msg.sender) initializer { + _scale = scale_; + } + + /** + * @dev Sets the values for {name}, {symbol},{decimals} and {owner}. + * + * these values can only be set once during construction or initialize. + */ + function initialize( + string memory name_, + string memory symbol_, + uint8 scale_, + address owner_ + ) public initializer { + _name = name_; + _symbol = symbol_; + _scale = scale_; + _transferOwnership(owner_); + } + + /** + * @dev Returns the number of decimals used to get its user representation. + * For example, if `decimals` equals `2`, a balance of `505` tokens should + * be displayed to a user as `5.05` (`505 / 10 ** 2`). + * + * Tokens usually opt for a value of 18, imitating the relationship between + * Ether and Wei. This is the default value returned by this function, unless + * it's overridden. + * + * NOTE: This information is only used for _display_ purposes: it in + * no way affects any of the arithmetic of the contract, including + * {IERC20-balanceOf} and {IERC20-transfer}. + */ + function decimals() public view override returns (uint8) { + return _scale; + } + + /** + * @dev Creates a `amount` amount of tokens and assigns them to `account`, by transferring it from address(0). + * Relies on the `_update` mechanism + * + * Emits a {Transfer} event with `from` set to the zero address. + * + * NOTE: This function is not virtual, {_update} should be overridden instead. + */ + function mint(address account, uint256 amount) public onlyOwner { + _mint(account, amount); + } + + /** + * @dev Destroys a `amount` amount of tokens from `account`, lowering the total supply. + * Relies on the `_update` mechanism. + * + * Emits a {Transfer} event with `to` set to the zero address. + * + * NOTE: This function is not virtual, {_update} should be overridden instead + */ + function burn(address account, uint256 amount) public onlyOwner { + _burn(account, amount); + } + + /** + * + * Requirements: + * + * - `to` cannot be the zero address. + * - `amount` caller must have a balance of at least `amount`. + */ + function swapToNative( + string memory to, + uint256 amount + ) public nonReentrant { + require(bytes(to).length > 0, "to must be vaild iaa address"); + + address sender = _msgSender(); + _burn(sender, amount); + emit SwapToNative(sender, to, amount); + } + + /** + * + * Requirements: + * + * - `from` authorizer address. + * - `to` cannot be the zero address. + * - `amount` from must have a balance of at least `amount`. + */ + function swapToNativeFrom( + address from, + string memory to, + uint256 amount + ) public nonReentrant { + require(bytes(to).length > 0, "to must be vaild iaa address"); + + address spender = _msgSender(); + _spendAllowance(from, spender, amount); + + _burn(from, amount); + emit SwapToNative(from, to, amount); + } + + /** + * @dev See {IERC165-supportsInterface} + */ + function supportsInterface( + bytes4 interfaceId + ) public view override returns (bool) { + return + interfaceId == type(IERC20).interfaceId || + interfaceId == type(IERC20Metadata).interfaceId || + super.supportsInterface(interfaceId); + } +} diff --git a/contracts/Token.sol b/contracts/Token.sol new file mode 100644 index 00000000..736329e4 --- /dev/null +++ b/contracts/Token.sol @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "./ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; +import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; + +contract Token is ERC20, Ownable, ReentrancyGuard, Initializable, ERC165 { + event SwapToNative(address from, string to, uint256 amount); + + uint8 private _scale; + uint8 public constant VERSION = 1; + + constructor( + string memory name_, + string memory symbol_, + uint8 scale_ + ) ERC20(name_, symbol_) Ownable(msg.sender) initializer { + _scale = scale_; + } + + /** + * @dev Sets the values for {name}, {symbol},{decimals} and {owner}. + * + * these values can only be set once during construction or initialize. + */ + function initialize( + string memory name_, + string memory symbol_, + uint8 scale_, + address owner_ + ) public initializer { + _name = name_; + _symbol = symbol_; + _scale = scale_; + _transferOwnership(owner_); + } + + /** + * @dev Returns the number of decimals used to get its user representation. + * For example, if `decimals` equals `2`, a balance of `505` tokens should + * be displayed to a user as `5.05` (`505 / 10 ** 2`). + * + * Tokens usually opt for a value of 18, imitating the relationship between + * Ether and Wei. This is the default value returned by this function, unless + * it's overridden. + * + * NOTE: This information is only used for _display_ purposes: it in + * no way affects any of the arithmetic of the contract, including + * {IERC20-balanceOf} and {IERC20-transfer}. + */ + function decimals() public view override returns (uint8) { + return _scale; + } + + /** + * @dev Creates a `amount` amount of tokens and assigns them to `account`, by transferring it from address(0). + * Relies on the `_update` mechanism + * + * Emits a {Transfer} event with `from` set to the zero address. + * + * NOTE: This function is not virtual, {_update} should be overridden instead. + */ + function mint(address account, uint256 amount) public onlyOwner { + _mint(account, amount); + } + + /** + * @dev Destroys a `amount` amount of tokens from `account`, lowering the total supply. + * Relies on the `_update` mechanism. + * + * Emits a {Transfer} event with `to` set to the zero address. + * + * NOTE: This function is not virtual, {_update} should be overridden instead + */ + function burn(address account, uint256 amount) public onlyOwner { + _burn(account, amount); + } + + /** + * + * Requirements: + * + * - `to` cannot be the zero address. + * - `amount` caller must have a balance of at least `amount`. + */ + function swapToNative( + string memory to, + uint256 amount + ) public nonReentrant { + require(bytes(to).length > 0, "to must be vaild iaa address"); + + address sender = _msgSender(); + _burn(sender, amount); + emit SwapToNative(sender, to, amount); + } + + /** + * + * Requirements: + * + * - `from` authorizer address. + * - `to` cannot be the zero address. + * - `amount` from must have a balance of at least `amount`. + */ + function swapToNativeFrom( + address from, + string memory to, + uint256 amount + ) public nonReentrant { + require(bytes(to).length > 0, "to must be vaild iaa address"); + + address spender = _msgSender(); + _spendAllowance(from, spender, amount); + + _burn(from, amount); + emit SwapToNative(from, to, amount); + } + + /** + * @dev See {IERC165-supportsInterface} + */ + function supportsInterface( + bytes4 interfaceId + ) public view override returns (bool) { + return + interfaceId == type(IERC20).interfaceId || + interfaceId == type(IERC20Metadata).interfaceId || + super.supportsInterface(interfaceId); + } +} diff --git a/contracts/TokenProxy.sol b/contracts/TokenProxy.sol new file mode 100644 index 00000000..6fee100b --- /dev/null +++ b/contracts/TokenProxy.sol @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; + +contract TokenProxy is BeaconProxy { + /** + * @dev Initializes the proxy with `beacon`. + * + * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the router. This + * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity + * constructor. + * + * Requirements: + * + * - `beacon` must be a contract with the interface {IBeacon}. + * - If `data` is empty, `msg.value` must be zero. + */ + constructor(address beacon, bytes memory data) BeaconProxy(beacon, data) {} + + /** + * @dev Returns the beacon. + */ + function getBeacon() public view returns (address) { + return _getBeacon(); + } + + /** + * @dev Returns the current implementation address of the associated beacon. + */ + function implementation() public view returns (address) { + return _implementation(); + } + + // This function allows the contract to receive Ether + receive() external payable {} +} \ No newline at end of file diff --git a/contracts/UpgradeableBeacon.sol b/contracts/UpgradeableBeacon.sol new file mode 100644 index 00000000..d6cf4387 --- /dev/null +++ b/contracts/UpgradeableBeacon.sol @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/UpgradeableBeacon.sol) + +pragma solidity ^0.8.20; + +import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; + +/** + * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their + * implementation contract, which is where they will delegate all function calls. + * + * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon. + */ +contract UpgradeableBeacon is IBeacon, Ownable { + address private _implementation; + + /** + * @dev The `implementation` of the beacon is invalid. + */ + error BeaconInvalidImplementation(address implementation); + + /** + * @dev Emitted when the implementation returned by the beacon is changed. + */ + event Upgraded(address indexed implementation); + + /** + * @dev Sets the address of the initial implementation, and the initial owner who can upgrade the beacon. + */ + constructor(address implementation_, address initialOwner) Ownable(initialOwner) { + _setImplementation(implementation_); + } + + /** + * @dev Returns the current implementation address. + */ + function implementation() public view virtual returns (address) { + return _implementation; + } + + /** + * @dev Upgrades the beacon to a new implementation. + * + * Emits an {Upgraded} event. + * + * Requirements: + * + * - msg.sender must be the owner of the contract. + * - `newImplementation` must be a contract. + */ + function upgradeTo(address newImplementation) public virtual onlyOwner { + _setImplementation(newImplementation); + } + + /** + * @dev Sets the implementation contract address for this beacon + * + * Requirements: + * + * - `newImplementation` must be a contract. + */ + function _setImplementation(address newImplementation) private { + if (newImplementation.code.length == 0) { + revert BeaconInvalidImplementation(newImplementation); + } + _implementation = newImplementation; + emit Upgraded(newImplementation); + } +} \ No newline at end of file diff --git a/contracts/compiled_contracts/Token.json b/contracts/compiled_contracts/Token.json new file mode 100644 index 00000000..124ac2ca --- /dev/null +++ b/contracts/compiled_contracts/Token.json @@ -0,0 +1,598 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "scale_", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allowance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "ERC20InsufficientAllowance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "ERC20InsufficientBalance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "approver", + "type": "address" + } + ], + "name": "ERC20InvalidApprover", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "ERC20InvalidReceiver", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "ERC20InvalidSender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "ERC20InvalidSpender", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInitialization", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "to", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "SwapToNative", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint8", + "name": "scale_", + "type": "uint8" + }, + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "to", + "type": "string" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "swapToNative", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "string", + "name": "to", + "type": "string" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "swapToNativeFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bin": "60806040523480156200001157600080fd5b50604051620014f1380380620014f18339810160408190526200003491620002da565b3383836003620000458382620003f0565b506004620000548282620003f0565b5050506001600160a01b0381166200008657604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6200009181620001c0565b5060016006557ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff1615906001600160401b0316600081158015620000e25750825b90506000826001600160401b03166001148015620000ff5750303b155b9050811580156200010e575080155b156200012d5760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b031916600117855583156200015c57845460ff60401b1916680100000000000000001785555b6007805460ff191660ff88161790558315620001b257845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050620004bc565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023a57600080fd5b81516001600160401b038082111562000257576200025762000212565b604051601f8301601f19908116603f0116810190828211818310171562000282576200028262000212565b8160405283815260209250866020858801011115620002a057600080fd5b600091505b83821015620002c45785820183015181830184015290820190620002a5565b6000602085830101528094505050505092915050565b600080600060608486031215620002f057600080fd5b83516001600160401b03808211156200030857600080fd5b620003168783880162000228565b945060208601519150808211156200032d57600080fd5b506200033c8682870162000228565b925050604084015160ff811681146200035457600080fd5b809150509250925092565b600181811c908216806200037457607f821691505b6020821081036200039557634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003eb576000816000526020600020601f850160051c81016020861015620003c65750805b601f850160051c820191505b81811015620003e757828155600101620003d2565b5050505b505050565b81516001600160401b038111156200040c576200040c62000212565b62000424816200041d84546200035f565b846200039b565b602080601f8311600181146200045c5760008415620004435750858301515b600019600386901b1c1916600185901b178555620003e7565b600085815260208120601f198616915b828110156200048d578886015182559484019460019091019084016200046c565b5085821015620004ac5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61102580620004cc6000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c8063715018a6116100ad578063dd62ed3e11610071578063dd62ed3e14610256578063de7ea79d1461028f578063e9e4e866146102a2578063f2fde38b146102b5578063ffa1ad74146102c857600080fd5b8063715018a6146102055780638da5cb5b1461020d57806395d89b41146102285780639dc29fac14610230578063a9059cbb1461024357600080fd5b806323b872dd116100f457806323b872dd14610188578063313ce5671461019b57806340c10f19146101b457806354162c9c146101c957806370a08231146101dc57600080fd5b806301ffc9a71461012657806306fdde031461014e578063095ea7b31461016357806318160ddd14610176575b600080fd5b610139610134366004610b2a565b6102d0565b60405190151581526020015b60405180910390f35b610156610322565b6040516101459190610ba1565b610139610171366004610bd0565b6103b4565b6002545b604051908152602001610145565b610139610196366004610bfa565b6103cc565b60075460ff165b60405160ff9091168152602001610145565b6101c76101c2366004610bd0565b6103f0565b005b6101c76101d7366004610cd9565b610406565b61017a6101ea366004610d1e565b6001600160a01b031660009081526020819052604090205490565b6101c76104b5565b6005546040516001600160a01b039091168152602001610145565b6101566104c9565b6101c761023e366004610bd0565b6104d8565b610139610251366004610bd0565b6104ea565b61017a610264366004610d39565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6101c761029d366004610d6c565b6104f8565b6101c76102b0366004610df9565b610634565b6101c76102c3366004610d1e565b6106ee565b6101a2600181565b60006001600160e01b031982166336372b0760e01b148061030157506001600160e01b0319821663a219a02560e01b145b8061031c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606003805461033190610e50565b80601f016020809104026020016040519081016040528092919081815260200182805461035d90610e50565b80156103aa5780601f1061037f576101008083540402835291602001916103aa565b820191906000526020600020905b81548152906001019060200180831161038d57829003601f168201915b5050505050905090565b6000336103c281858561072c565b5060019392505050565b6000336103da858285610739565b6103e58585856107b7565b506001949350505050565b6103f8610816565b6104028282610843565b5050565b61040e610879565b60008251116104645760405162461bcd60e51b815260206004820152601c60248201527f746f206d757374206265207661696c642069616120616464726573730000000060448201526064015b60405180910390fd5b3361046f81836108a3565b7faccd23c8bfefb9bb75038060da86669b045e6212cc3d5a08f4d571af8cd4fce58184846040516104a293929190610e8a565b60405180910390a1506104026001600655565b6104bd610816565b6104c760006108d9565b565b60606004805461033190610e50565b6104e0610816565b61040282826108a3565b6000336103c28185856107b7565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff1660008115801561053e5750825b905060008267ffffffffffffffff16600114801561055b5750303b155b905081158015610569575080155b156105875760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156105b157845460ff60401b1916600160401b1785555b60036105bd8a82610f0e565b5060046105ca8982610f0e565b506007805460ff191660ff89161790556105e3866108d9565b831561062957845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b61063c610879565b600082511161068d5760405162461bcd60e51b815260206004820152601c60248201527f746f206d757374206265207661696c6420696161206164647265737300000000604482015260640161045b565b33610699848284610739565b6106a384836108a3565b7faccd23c8bfefb9bb75038060da86669b045e6212cc3d5a08f4d571af8cd4fce58484846040516106d693929190610e8a565b60405180910390a1506106e96001600655565b505050565b6106f6610816565b6001600160a01b03811661072057604051631e4fbdf760e01b81526000600482015260240161045b565b610729816108d9565b50565b6106e9838383600161092b565b6001600160a01b0383811660009081526001602090815260408083209386168352929052205460001981146107b157818110156107a257604051637dc7a0d960e11b81526001600160a01b0384166004820152602481018290526044810183905260640161045b565b6107b18484848403600061092b565b50505050565b6001600160a01b0383166107e157604051634b637e8f60e11b81526000600482015260240161045b565b6001600160a01b03821661080b5760405163ec442f0560e01b81526000600482015260240161045b565b6106e9838383610a00565b6005546001600160a01b031633146104c75760405163118cdaa760e01b815233600482015260240161045b565b6001600160a01b03821661086d5760405163ec442f0560e01b81526000600482015260240161045b565b61040260008383610a00565b60026006540361089c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600655565b6001600160a01b0382166108cd57604051634b637e8f60e11b81526000600482015260240161045b565b61040282600083610a00565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0384166109555760405163e602df0560e01b81526000600482015260240161045b565b6001600160a01b03831661097f57604051634a1406b160e11b81526000600482015260240161045b565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156107b157826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516109f291815260200190565b60405180910390a350505050565b6001600160a01b038316610a2b578060026000828254610a209190610fce565b90915550610a9d9050565b6001600160a01b03831660009081526020819052604090205481811015610a7e5760405163391434e360e21b81526001600160a01b0385166004820152602481018290526044810183905260640161045b565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610ab957600280548290039055610ad8565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610b1d91815260200190565b60405180910390a3505050565b600060208284031215610b3c57600080fd5b81356001600160e01b031981168114610b5457600080fd5b9392505050565b6000815180845260005b81811015610b8157602081850181015186830182015201610b65565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610b546020830184610b5b565b80356001600160a01b0381168114610bcb57600080fd5b919050565b60008060408385031215610be357600080fd5b610bec83610bb4565b946020939093013593505050565b600080600060608486031215610c0f57600080fd5b610c1884610bb4565b9250610c2660208501610bb4565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610c5d57600080fd5b813567ffffffffffffffff80821115610c7857610c78610c36565b604051601f8301601f19908116603f01168101908282118183101715610ca057610ca0610c36565b81604052838152866020858801011115610cb957600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215610cec57600080fd5b823567ffffffffffffffff811115610d0357600080fd5b610d0f85828601610c4c565b95602094909401359450505050565b600060208284031215610d3057600080fd5b610b5482610bb4565b60008060408385031215610d4c57600080fd5b610d5583610bb4565b9150610d6360208401610bb4565b90509250929050565b60008060008060808587031215610d8257600080fd5b843567ffffffffffffffff80821115610d9a57600080fd5b610da688838901610c4c565b95506020870135915080821115610dbc57600080fd5b50610dc987828801610c4c565b935050604085013560ff81168114610de057600080fd5b9150610dee60608601610bb4565b905092959194509250565b600080600060608486031215610e0e57600080fd5b610e1784610bb4565b9250602084013567ffffffffffffffff811115610e3357600080fd5b610e3f86828701610c4c565b925050604084013590509250925092565b600181811c90821680610e6457607f821691505b602082108103610e8457634e487b7160e01b600052602260045260246000fd5b50919050565b6001600160a01b0384168152606060208201819052600090610eae90830185610b5b565b9050826040830152949350505050565b601f8211156106e9576000816000526020600020601f850160051c81016020861015610ee75750805b601f850160051c820191505b81811015610f0657828155600101610ef3565b505050505050565b815167ffffffffffffffff811115610f2857610f28610c36565b610f3c81610f368454610e50565b84610ebe565b602080601f831160018114610f715760008415610f595750858301515b600019600386901b1c1916600185901b178555610f06565b600085815260208120601f198616915b82811015610fa057888601518255948401946001909101908401610f81565b5085821015610fbe5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8082018082111561031c57634e487b7160e01b600052601160045260246000fdfea264697066735822122038d45b9e40b0dd5c8c9a95fa33c5eca2ac1cd6617489d073377e3a53d438197164736f6c63430008170033" +} diff --git a/contracts/compiled_contracts/TokenProxy.json b/contracts/compiled_contracts/TokenProxy.json new file mode 100644 index 00000000..63104d66 --- /dev/null +++ b/contracts/compiled_contracts/TokenProxy.json @@ -0,0 +1,111 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "beacon", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "ERC1967InvalidBeacon", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "ERC1967InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "ERC1967NonPayable", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "getBeacon", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bin": "60a060405234801561001057600080fd5b5060405161067938038061067983398101604081905261002f91610399565b818161003b8282610050565b506001600160a01b0316608052506104909050565b61005982610110565b6040516001600160a01b038316907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a2805115610104576100ff826001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100f99190610459565b82610223565b505050565b61010c61029a565b5050565b806001600160a01b03163b60000361014b57604051631933b43b60e21b81526001600160a01b03821660048201526024015b60405180910390fd5b807fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b0392831617905560408051635c60da1b60e01b81529051600092841691635c60da1b9160048083019260209291908290030181865afa1580156101c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101eb9190610459565b9050806001600160a01b03163b60000361010c57604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610142565b6060600080846001600160a01b0316846040516102409190610474565b600060405180830381855af49150503d806000811461027b576040519150601f19603f3d011682016040523d82523d6000602084013e610280565b606091505b5090925090506102918583836102bb565b95945050505050565b34156102b95760405163b398979f60e01b815260040160405180910390fd5b565b6060826102d0576102cb8261031a565b610313565b81511580156102e757506001600160a01b0384163b155b1561031057604051639996b31560e01b81526001600160a01b0385166004820152602401610142565b50805b9392505050565b80511561032a5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80516001600160a01b038116811461035a57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015610390578181015183820152602001610378565b50506000910152565b600080604083850312156103ac57600080fd5b6103b583610343565b60208401519092506001600160401b03808211156103d257600080fd5b818501915085601f8301126103e657600080fd5b8151818111156103f8576103f861035f565b604051601f8201601f19908116603f011681019083821181831017156104205761042061035f565b8160405282815288602084870101111561043957600080fd5b61044a836020830160208801610375565b80955050505050509250929050565b60006020828403121561046b57600080fd5b61031382610343565b60008251610486818460208701610375565b9190910192915050565b6080516101c96104b060003960008181604d015260bf01526101c96000f3fe60806040526004361061002d5760003560e01c80632d6b3a6b1461003e5780635c60da1b1461008957610034565b3661003457005b61003c61009e565b005b34801561004a57600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200160405180910390f35b34801561009557600080fd5b5061006d6100b5565b6100ae6100a96100bb565b61013f565b565b905090565b60006100b05b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561011b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100b09190610163565b3660008037600080366000845af43d6000803e80801561015e573d6000f35b3d6000fd5b60006020828403121561017557600080fd5b81516001600160a01b038116811461018c57600080fd5b939250505056fea26469706673582212208b5650c1db5b7f1b1fac3bf7542a04f54fef1013df6e6bfe0f654e01e4a7c21b64736f6c63430008170033" +} diff --git a/contracts/compiled_contracts/UpgradeableBeacon.json b/contracts/compiled_contracts/UpgradeableBeacon.json new file mode 100644 index 00000000..ac4d4820 --- /dev/null +++ b/contracts/compiled_contracts/UpgradeableBeacon.json @@ -0,0 +1,145 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { + "internalType": "address", + "name": "initialOwner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "BeaconInvalidImplementation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bin": "608060405234801561001057600080fd5b5060405161043838038061043883398101604081905261002f91610165565b806001600160a01b03811661005f57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61006881610079565b50610072826100c9565b5050610198565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b806001600160a01b03163b6000036100ff5760405163211eb15960e21b81526001600160a01b0382166004820152602401610056565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b80516001600160a01b038116811461016057600080fd5b919050565b6000806040838503121561017857600080fd5b61018183610149565b915061018f60208401610149565b90509250929050565b610291806101a76000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a36600461022b565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f6100da565b6000546001600160a01b031661007e565b61006f6100c136600461022b565b6100ee565b6100ce61012e565b6100d78161015b565b50565b6100e261012e565b6100ec60006101db565b565b6100f661012e565b6001600160a01b03811661012557604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6100d7816101db565b6000546001600160a01b031633146100ec5760405163118cdaa760e01b815233600482015260240161011c565b806001600160a01b03163b6000036101915760405163211eb15960e21b81526001600160a01b038216600482015260240161011c565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561023d57600080fd5b81356001600160a01b038116811461025457600080fd5b939250505056fea26469706673582212205b1b27183336955cbfa7c1ea14bb33fa343bb0e7f2b847bfa12815a13dfeca8264736f6c63430008170033" +} diff --git a/contracts/erc20.go b/contracts/erc20.go new file mode 100644 index 00000000..858bee28 --- /dev/null +++ b/contracts/erc20.go @@ -0,0 +1,58 @@ +package contracts + +import ( + _ "embed" + "encoding/json" + + "github.com/irisnet/irismod/types" +) + +const ( + EventSwapToNative = "SwapToNative" + MethodMint = "mint" + MethodBurn = "burn" + MethodBalanceOf = "balanceOf" + MethodInitialize = "initialize" + MethodUpgradeTo = "upgradeTo" +) + +var ( + //go:embed compiled_contracts/Token.json + ERC20JSON []byte //nolint: golint + + //go:embed compiled_contracts/TokenProxy.json + TokenProxyJSON []byte //nolint: golint + + //go:embed compiled_contracts/UpgradeableBeacon.json + BeaconJSON []byte //nolint: golint + + // ERC20TokenContract is the compiled erc20 contract + ERC20TokenContract types.CompiledContract + + // TokenProxyContract is the compiled erc20 contract proxy + TokenProxyContract types.CompiledContract + + // BeaconContract is the compiled beacon contract proxy + BeaconContract types.CompiledContract +) + +func init() { + err := json.Unmarshal(ERC20JSON, &ERC20TokenContract) + if err != nil { + panic(err) + } + + err = json.Unmarshal(BeaconJSON, &BeaconContract) + if err != nil { + panic(err) + } + + err = json.Unmarshal(TokenProxyJSON, &TokenProxyContract) + if err != nil { + panic(err) + } + + if len(TokenProxyContract.Bin) == 0 { + panic("load token proxy contract failed") + } +} diff --git a/contracts/erc20_test.go b/contracts/erc20_test.go new file mode 100644 index 00000000..d287b7ef --- /dev/null +++ b/contracts/erc20_test.go @@ -0,0 +1,13 @@ +package contracts_test + +import ( + "testing" + + "github.com/irisnet/irismod/contracts" +) + +func TestERC20(t *testing.T) { + for k, v := range contracts.ERC20TokenContract.ABI.Events { + t.Logf("event:%s ,id: %s", k, v.ID) + } +} diff --git a/go.mod b/go.mod index e57718af..a4a32fc6 100644 --- a/go.mod +++ b/go.mod @@ -5,14 +5,15 @@ module github.com/irisnet/irismod require ( cosmossdk.io/api v0.3.1 cosmossdk.io/core v0.5.1 - cosmossdk.io/depinject v1.0.0-alpha.3 - cosmossdk.io/errors v1.0.0 - cosmossdk.io/math v1.0.1 - github.com/cometbft/cometbft v0.37.2 + cosmossdk.io/depinject v1.0.0-alpha.4 + cosmossdk.io/errors v1.0.1 + cosmossdk.io/math v1.2.0 + github.com/cometbft/cometbft v0.37.4 github.com/cometbft/cometbft-db v0.7.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 - github.com/cosmos/cosmos-sdk v0.47.4 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 + github.com/cosmos/cosmos-sdk v0.47.9 github.com/cosmos/gogoproto v1.4.10 + github.com/ethereum/go-ethereum v1.10.26 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -23,25 +24,27 @@ require ( github.com/stretchr/testify v1.8.4 github.com/tidwall/gjson v1.14.4 github.com/xeipuuv/gojsonschema v1.2.0 - google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 - google.golang.org/grpc v1.56.3 - google.golang.org/protobuf v1.31.0 + google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 + google.golang.org/grpc v1.60.1 + google.golang.org/protobuf v1.32.0 gopkg.in/yaml.v2 v2.4.0 sigs.k8s.io/yaml v1.3.0 ) require ( - cloud.google.com/go v0.110.4 // indirect - cloud.google.com/go/compute v1.20.1 // indirect + cloud.google.com/go v0.111.0 // indirect + cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.0 // indirect + cloud.google.com/go/iam v1.1.5 // indirect cloud.google.com/go/storage v1.30.1 // indirect - cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca // indirect + cosmossdk.io/log v1.3.1 // indirect cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect + github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect + github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect + github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/aws/aws-sdk-go v1.44.203 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -53,44 +56,52 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect + github.com/cockroachdb/errors v1.10.0 // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/redact v1.1.5 // indirect github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v0.20.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect + github.com/cosmos/iavl v0.20.1 // indirect + github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/deckarep/golang-set v1.8.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/dvsekhvalnov/jose2go v1.5.0 // indirect + github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/gin-gonic/gin v1.8.1 // indirect + github.com/getsentry/sentry-go v0.23.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect + github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-stack/stack v1.8.0 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.0 // indirect + github.com/golang/glog v1.1.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.4 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.11.0 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/google/uuid v1.4.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect @@ -105,18 +116,23 @@ require ( github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect + github.com/holiman/bloomfilter/v2 v2.0.3 // indirect + github.com/holiman/uint256 v1.2.0 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.16.3 // indirect + github.com/klauspost/compress v1.16.7 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect @@ -124,6 +140,7 @@ require ( github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.7 // indirect github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect @@ -133,10 +150,13 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/tsdb v0.7.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.8.2 // indirect - github.com/rs/zerolog v1.29.1 // indirect + github.com/rs/zerolog v1.32.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spf13/afero v1.9.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/viper v1.14.0 // indirect @@ -147,29 +167,35 @@ require ( github.com/tidwall/btree v1.6.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect + github.com/tklauser/go-sysconf v0.3.5 // indirect + github.com/tklauser/numcpus v0.2.2 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect - github.com/zondax/hid v0.9.1 // indirect - github.com/zondax/ledger-go v0.14.0 // indirect + github.com/zondax/hid v0.9.2 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.126.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + go.opentelemetry.io/otel v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect + golang.org/x/crypto v0.16.0 // indirect + golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/oauth2 v0.13.0 // indirect + golang.org/x/sync v0.4.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/api v0.149.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect - pgregory.net/rapid v0.5.5 // indirect + pgregory.net/rapid v1.1.0 // indirect ) replace ( diff --git a/go.sum b/go.sum index d52ce75a..81ca75e7 100644 --- a/go.sum +++ b/go.sum @@ -32,8 +32,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.110.4 h1:1JYyxKMN9hd5dR2MYTPWkGUgcoxVVhg0LKNKEo0qvmk= -cloud.google.com/go v0.110.4/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= +cloud.google.com/go v0.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= +cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -70,8 +70,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.20.1 h1:6aKEtlUiwEpJzM001l0yFkpXmUVXaN8W+fbkb2AZNbg= -cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= @@ -111,8 +111,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.0 h1:67gSqaPukx7O8WLLHMa0PNs3EBGd2eE4d+psbO/CO94= -cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk= +cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= +cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -191,14 +191,14 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= -cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= -cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= -cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= -cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca h1:msenprh2BLLRwNT7zN56TbBHOGk/7ARQckXHxXyvjoQ= -cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca/go.mod h1:PkIAKXZvaxrTRc++z53XMRvFk8AcGGWYHcMIPzVYX9c= -cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= -cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= +cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= +cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= +cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -209,8 +209,8 @@ github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 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/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= +github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= @@ -219,16 +219,21 @@ 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/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/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= +github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/alecthomas/participle/v2 v2.0.0-alpha7 h1:cK4vjj0VSgb3lN1nuKA5F7dw+1s1pWBe5bx7nNCnN+c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -302,13 +307,18 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= -github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= +github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= -github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= +github.com/cometbft/cometbft v0.37.4 h1:xyvvEqlyfK8MgNIIKVJaMsuIp03wxOcFmVkT26+Ikpg= +github.com/cometbft/cometbft v0.37.4/go.mod h1:Cmg5Hp4sNpapm7j+x0xRyt2g0juQfmB752ous+pA0G8= github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= @@ -322,10 +332,10 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= -github.com/cosmos/cosmos-sdk v0.47.4 h1:FVUpEprm58nMmBX4xkRdMDaIG5Nr4yy92HZAfGAw9bg= -github.com/cosmos/cosmos-sdk v0.47.4/go.mod h1:R5n+uM7vguVPFap4pgkdvQCT1nVo/OtPwrlAU40rvok= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= +github.com/cosmos/cosmos-sdk v0.47.9 h1:D51VLkF59D53PMLsbNtp6JyWR+6MbetFyomrH88+y08= +github.com/cosmos/cosmos-sdk v0.47.9/go.mod h1:cmAawe8FV/52oPKbgeHLt4UpNkrNu8R5KD+kw0kxJFc= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -334,12 +344,12 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= -github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= -github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= +github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg= +github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w= -github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= +github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw= +github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M= github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -349,13 +359,13 @@ github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6V github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0= -github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= @@ -369,17 +379,19 @@ github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkz github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= -github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= +github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -392,6 +404,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s= +github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= @@ -407,11 +421,14 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= +github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8= github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -427,6 +444,13 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= @@ -435,6 +459,7 @@ github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91 github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU= github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= @@ -447,7 +472,6 @@ github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= @@ -460,8 +484,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -520,8 +544,9 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= @@ -549,17 +574,18 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -569,8 +595,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= -github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -639,6 +665,10 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= +github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= +github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= @@ -683,8 +713,8 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= -github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -695,6 +725,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -714,18 +745,19 @@ github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPK github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -773,7 +805,10 @@ github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= @@ -813,6 +848,7 @@ github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6 github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -839,6 +875,7 @@ github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= @@ -855,24 +892,27 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= -github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= +github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -881,6 +921,8 @@ github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0 github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -949,6 +991,10 @@ github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= +github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= +github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= +github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= @@ -975,10 +1021,10 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.0 h1:dlMC7aO8Wss1CxBq2I96kZ69Nh1ligzbs8UWOtq/AsA= -github.com/zondax/ledger-go v0.14.0/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= @@ -994,6 +1040,13 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= +go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= +go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= +go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= +go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= +go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1019,10 +1072,9 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1034,8 +1086,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= -golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1062,7 +1114,7 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1111,7 +1163,6 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -1126,8 +1177,8 @@ golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1153,8 +1204,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= +golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1169,7 +1220,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1228,7 +1280,9 @@ golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1243,7 +1297,6 @@ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1269,15 +1322,16 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1291,8 +1345,8 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1418,8 +1472,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= -google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= +google.golang.org/api v0.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= +google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1427,8 +1481,9 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1537,12 +1592,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 h1:Au6te5hbKUV8pIYWHqOUZ1pva5qK/rwbIhoXEUB9Lu8= -google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 h1:s5YSX+ZH5b5vS9rnpGymvIyMpLRJizowqDlOuyjXnTk= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= +google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 h1:s1w3X6gQxwrLEpxnLd/qXTVLgQE2yXwaOaoa6IlY/+o= +google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0/go.mod h1:CAny0tYF+0/9rmDB9fahA9YLzX3+AEVl1qXbv5hhj6c= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= 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= @@ -1584,8 +1639,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= -google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1602,8 +1657,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1618,6 +1673,8 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= @@ -1637,7 +1694,7 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1648,8 +1705,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= -pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/modules/coinswap/keeper/fees.go b/modules/coinswap/keeper/fees.go index ed479278..4b7e995d 100644 --- a/modules/coinswap/keeper/fees.go +++ b/modules/coinswap/keeper/fees.go @@ -1,4 +1,4 @@ -//nolint +// nolint package keeper import ( diff --git a/modules/coinswap/keeper/grpc_query.go b/modules/coinswap/keeper/grpc_query.go index 4b7b6856..232fba5f 100644 --- a/modules/coinswap/keeper/grpc_query.go +++ b/modules/coinswap/keeper/grpc_query.go @@ -6,9 +6,9 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" "github.com/irisnet/irismod/modules/coinswap/types" @@ -28,7 +28,7 @@ func (k Keeper) LiquidityPool( ctx := sdk.UnwrapSDKContext(c) pool, exists := k.GetPoolByLptDenom(ctx, req.LptDenom) if !exists { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrReservePoolNotExists, "liquidity pool token: %s", req.LptDenom, diff --git a/modules/coinswap/keeper/keeper.go b/modules/coinswap/keeper/keeper.go index 6ff7de8f..6f845654 100644 --- a/modules/coinswap/keeper/keeper.go +++ b/modules/coinswap/keeper/keeper.go @@ -8,6 +8,7 @@ import ( sdkmath "cosmossdk.io/math" "github.com/cometbft/cometbft/libs/log" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -103,7 +104,7 @@ func (k Keeper) Swap(ctx sdk.Context, msg *types.MsgSwapOrder) error { func (k Keeper) AddLiquidity(ctx sdk.Context, msg *types.MsgAddLiquidity) (sdk.Coin, error) { standardDenom := k.GetStandardDenom(ctx) if standardDenom == msg.MaxToken.Denom { - return sdk.Coin{}, sdkerrors.Wrapf(types.ErrInvalidDenom, + return sdk.Coin{}, errorsmod.Wrapf(types.ErrInvalidDenom, "MaxToken: %s should not be StandardDenom", msg.MaxToken.String()) } @@ -131,7 +132,7 @@ func (k Keeper) AddLiquidity(ctx sdk.Context, msg *types.MsgAddLiquidity) (sdk.C mintLiquidityAmt = msg.ExactStandardAmt if mintLiquidityAmt.LT(msg.MinLiquidity) { - return sdk.Coin{}, sdkerrors.Wrapf( + return sdk.Coin{}, errorsmod.Wrapf( types.ErrConstraintNotMet, "liquidity amount not met, user expected: no less than %s, actual: %s", msg.MinLiquidity.String(), @@ -160,7 +161,7 @@ func (k Keeper) AddLiquidity(ctx sdk.Context, msg *types.MsgAddLiquidity) (sdk.C if balances == nil || balances.IsZero() { mintLiquidityAmt = msg.ExactStandardAmt if mintLiquidityAmt.LT(msg.MinLiquidity) { - return sdk.Coin{}, sdkerrors.Wrapf( + return sdk.Coin{}, errorsmod.Wrapf( types.ErrConstraintNotMet, "liquidity amount not met, user expected: no less than %s, actual: %s", msg.MinLiquidity.String(), @@ -185,12 +186,12 @@ func (k Keeper) AddLiquidity(ctx sdk.Context, msg *types.MsgAddLiquidity) (sdk.C liquidity := k.bk.GetSupply(ctx, pool.LptDenom).Amount if standardReserveAmt.IsZero() || tokenReserveAmt.IsZero() || liquidity.IsZero() { return sdk.Coin{}, - sdkerrors.Wrapf(types.ErrConstraintNotMet, "liquidity pool invalid") + errorsmod.Wrapf(types.ErrConstraintNotMet, "liquidity pool invalid") } mintLiquidityAmt = (liquidity.Mul(msg.ExactStandardAmt)).Quo(standardReserveAmt) if mintLiquidityAmt.LT(msg.MinLiquidity) { - return sdk.Coin{}, sdkerrors.Wrapf( + return sdk.Coin{}, errorsmod.Wrapf( types.ErrConstraintNotMet, "liquidity amount not met, user expected: no less than %s, actual: %s", msg.MinLiquidity.String(), @@ -202,7 +203,7 @@ func (k Keeper) AddLiquidity(ctx sdk.Context, msg *types.MsgAddLiquidity) (sdk.C if depositAmt.GT(msg.MaxToken.Amount) { return sdk.Coin{}, - sdkerrors.Wrapf( + errorsmod.Wrapf( types.ErrConstraintNotMet, "token amount not met, user expected: no more than %s, actual: %s", msg.MaxToken.String(), @@ -273,7 +274,7 @@ func (k Keeper) AddUnilateralLiquidity( poolID := types.GetPoolId(msg.CounterpartyDenom) pool, exist := k.GetPool(ctx, poolID) if !exist { - return sdk.Coin{}, sdkerrors.Wrapf( + return sdk.Coin{}, errorsmod.Wrapf( types.ErrReservePoolNotExists, "liquidity pool: %s ", poolID, @@ -292,7 +293,7 @@ func (k Keeper) AddUnilateralLiquidity( if msg.ExactToken.Denom != msg.CounterpartyDenom && msg.ExactToken.Denom != k.GetStandardDenom(ctx) { - return sdk.Coin{}, sdkerrors.Wrapf( + return sdk.Coin{}, errorsmod.Wrapf( types.ErrInvalidDenom, "liquidity pool %s has no %s", poolID, @@ -301,7 +302,7 @@ func (k Keeper) AddUnilateralLiquidity( } if balances == nil || balances.IsZero() { - return sdk.Coin{}, sdkerrors.Wrapf( + return sdk.Coin{}, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "When the liquidity is empty, can not add unilateral liquidity", ) @@ -329,7 +330,7 @@ func (k Keeper) AddUnilateralLiquidity( mintLptAmt := sdkmath.NewIntFromBigInt(squareBigInt).Sub(lptBalanceAmt) if mintLptAmt.LT(msg.MinLiquidity) { - return sdk.Coin{}, sdkerrors.Wrapf( + return sdk.Coin{}, errorsmod.Wrapf( types.ErrConstraintNotMet, "liquidity amount not met, user expected: no less than %s, actual: %s", msg.MinLiquidity.String(), @@ -394,7 +395,7 @@ func (k Keeper) RemoveLiquidity(ctx sdk.Context, msg *types.MsgRemoveLiquidity) pool, exists := k.GetPoolByLptDenom(ctx, msg.WithdrawLiquidity.Denom) if !exists { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrReservePoolNotExists, "liquidity pool token: %s", msg.WithdrawLiquidity.Denom, @@ -413,7 +414,7 @@ func (k Keeper) RemoveLiquidity(ctx sdk.Context, msg *types.MsgRemoveLiquidity) tokenReserveAmt := balances.AmountOf(minTokenDenom) liquidityReserve := k.bk.GetSupply(ctx, lptDenom).Amount if standardReserveAmt.LT(msg.MinStandardAmt) { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInsufficientFunds, "insufficient %s funds, user expected: %s, actual: %s", standardDenom, @@ -422,7 +423,7 @@ func (k Keeper) RemoveLiquidity(ctx sdk.Context, msg *types.MsgRemoveLiquidity) ) } if tokenReserveAmt.LT(msg.MinToken) { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInsufficientFunds, "insufficient %s funds, user expected: %s, actual: %s", minTokenDenom, @@ -431,7 +432,7 @@ func (k Keeper) RemoveLiquidity(ctx sdk.Context, msg *types.MsgRemoveLiquidity) ) } if liquidityReserve.LT(msg.WithdrawLiquidity.Amount) { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInsufficientFunds, "insufficient %s funds, user expected: %s, actual: %s", lptDenom, @@ -450,7 +451,7 @@ func (k Keeper) RemoveLiquidity(ctx sdk.Context, msg *types.MsgRemoveLiquidity) deductUniCoin := msg.WithdrawLiquidity if irisWithdrawCoin.Amount.LT(msg.MinStandardAmt) { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrConstraintNotMet, "iris amount not met, user expected: no less than %s, actual: %s", sdk.NewCoin(standardDenom, msg.MinStandardAmt).String(), @@ -458,7 +459,7 @@ func (k Keeper) RemoveLiquidity(ctx sdk.Context, msg *types.MsgRemoveLiquidity) ) } if tokenWithdrawCoin.Amount.LT(msg.MinToken) { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrConstraintNotMet, "token amount not met, user expected: no less than %s, actual: %s", sdk.NewCoin(minTokenDenom, msg.MinToken).String(), @@ -529,7 +530,7 @@ func (k Keeper) RemoveUnilateralLiquidity( poolID := types.GetPoolId(msg.CounterpartyDenom) pool, exist := k.GetPool(ctx, poolID) if !exist { - return sdk.Coins{}, sdkerrors.Wrapf( + return sdk.Coins{}, errorsmod.Wrapf( types.ErrReservePoolNotExists, "liquidity pool: %s ", poolID, @@ -548,7 +549,7 @@ func (k Keeper) RemoveUnilateralLiquidity( if msg.MinToken.Denom != msg.CounterpartyDenom && msg.MinToken.Denom != k.GetStandardDenom(ctx) { - return sdk.Coins{}, sdkerrors.Wrapf(types.ErrInvalidDenom, + return sdk.Coins{}, errorsmod.Wrapf(types.ErrInvalidDenom, "liquidity pool %s has no %s", poolID, msg.MinToken.Denom) } @@ -559,13 +560,13 @@ func (k Keeper) RemoveUnilateralLiquidity( lptBalanceAmt := k.bk.GetSupply(ctx, lptDenom).Amount if lptBalanceAmt.LT(msg.ExactLiquidity) { - return sdk.Coins{}, sdkerrors.Wrapf(types.ErrInsufficientFunds, + return sdk.Coins{}, errorsmod.Wrapf(types.ErrInsufficientFunds, "insufficient %s funds, user expected: %s, actual: %s", lptDenom, msg.ExactLiquidity.String(), lptBalanceAmt.String()) } if lptBalanceAmt.Equal(msg.ExactLiquidity) { - return sdk.Coins{}, sdkerrors.Wrapf( + return sdk.Coins{}, errorsmod.Wrapf( types.ErrConstraintNotMet, "forbid to withdraw all liquidity unilaterally, should be less than: %s", lptBalanceAmt.String(), @@ -573,7 +574,7 @@ func (k Keeper) RemoveUnilateralLiquidity( } if targetBalanceAmt.LT(msg.MinToken.Amount) { - return sdk.Coins{}, sdkerrors.Wrapf(types.ErrInsufficientFunds, + return sdk.Coins{}, errorsmod.Wrapf(types.ErrInsufficientFunds, "insufficient %s funds, user expected: %s, actual: %s", targetTokenDenom, msg.MinToken.Amount.String(), targetBalanceAmt.String()) } @@ -603,7 +604,7 @@ func (k Keeper) RemoveUnilateralLiquidity( targetTokenAmtAfterFee := targetTokenNumerator.Quo(targetTokenDenominator) if targetTokenAmtAfterFee.LT(msg.MinToken.Amount) { - return nil, sdkerrors.Wrapf(types.ErrConstraintNotMet, + return nil, errorsmod.Wrapf(types.ErrConstraintNotMet, "token withdrawn amount not met, user expected: no less than %s, actual: %s", msg.MinToken.String(), sdk.NewCoin(targetTokenDenom, targetTokenAmtAfterFee).String()) } diff --git a/modules/coinswap/keeper/keeper_test.go b/modules/coinswap/keeper/keeper_test.go index 895ff9c8..52c6e691 100644 --- a/modules/coinswap/keeper/keeper_test.go +++ b/modules/coinswap/keeper/keeper_test.go @@ -337,7 +337,7 @@ func (suite *TestSuite) TestLiquidity2() { suite.Equal( "14135062787267695755", suite.app.BankKeeper.GetSupply(suite.ctx, pool.LptDenom).Amount.String(), - ) // todo theoretical lpt ammount + ) // todo theoretical lpt amount // 2.2 poolBalances expCoins = sdk.NewCoins( diff --git a/modules/coinswap/keeper/msg_server.go b/modules/coinswap/keeper/msg_server.go index 5d346f2c..2c064a57 100644 --- a/modules/coinswap/keeper/msg_server.go +++ b/modules/coinswap/keeper/msg_server.go @@ -4,6 +4,7 @@ import ( "context" "time" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -29,7 +30,7 @@ func (m msgServer) AddLiquidity( ctx := sdk.UnwrapSDKContext(goCtx) // check that deadline has not passed if ctx.BlockHeader().Time.After(time.Unix(msg.Deadline, 0)) { - return nil, sdkerrors.Wrap( + return nil, errorsmod.Wrap( types.ErrInvalidDeadline, "deadline has passed for MsgAddLiquidity", ) @@ -52,7 +53,7 @@ func (m msgServer) AddUnilateralLiquidity( ctx := sdk.UnwrapSDKContext(goCtx) // check that deadline has not passed if ctx.BlockHeader().Time.After(time.Unix(msg.Deadline, 0)) { - return nil, sdkerrors.Wrap( + return nil, errorsmod.Wrap( types.ErrInvalidDeadline, "deadline has passed for MsgAddUnilateralLiquidity", ) @@ -75,7 +76,7 @@ func (m msgServer) RemoveLiquidity( ctx := sdk.UnwrapSDKContext(goCtx) // check that deadline has not passed if ctx.BlockHeader().Time.After(time.Unix(msg.Deadline, 0)) { - return nil, sdkerrors.Wrap( + return nil, errorsmod.Wrap( types.ErrInvalidDeadline, "deadline has passed for MsgRemoveLiquidity", ) @@ -96,7 +97,7 @@ func (m msgServer) RemoveUnilateralLiquidity( ctx := sdk.UnwrapSDKContext(goCtx) // check that deadline has not passed if ctx.BlockHeader().Time.After(time.Unix(msg.Deadline, 0)) { - return nil, sdkerrors.Wrap( + return nil, errorsmod.Wrap( types.ErrInvalidDeadline, "deadline has passed for MsgRemoveLiquidity", ) @@ -118,11 +119,11 @@ func (m msgServer) SwapCoin( ctx := sdk.UnwrapSDKContext(goCtx) // check that deadline has not passed if ctx.BlockHeader().Time.After(time.Unix(msg.Deadline, 0)) { - return nil, sdkerrors.Wrap(types.ErrInvalidDeadline, "deadline has passed for MsgSwapOrder") + return nil, errorsmod.Wrap(types.ErrInvalidDeadline, "deadline has passed for MsgSwapOrder") } if m.k.blockedAddrs[msg.Output.Address] { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrUnauthorized, "%s is not allowed to receive external funds", msg.Output.Address, @@ -140,7 +141,7 @@ func (m msgServer) UpdateParams( msg *types.MsgUpdateParams, ) (*types.MsgUpdateParamsResponse, error) { if m.k.authority != msg.Authority { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrUnauthorized, "invalid authority; expected %s, got %s", m.k.authority, diff --git a/modules/coinswap/keeper/params.go b/modules/coinswap/keeper/params.go index 455d861c..843cd507 100644 --- a/modules/coinswap/keeper/params.go +++ b/modules/coinswap/keeper/params.go @@ -3,6 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" gogotypes "github.com/cosmos/gogoproto/types" + "github.com/irisnet/irismod/modules/coinswap/types" ) diff --git a/modules/coinswap/keeper/pool.go b/modules/coinswap/keeper/pool.go index d61835d8..15c5a60b 100644 --- a/modules/coinswap/keeper/pool.go +++ b/modules/coinswap/keeper/pool.go @@ -5,8 +5,8 @@ import ( gogotypes "github.com/cosmos/gogoproto/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/coinswap/types" ) @@ -84,7 +84,7 @@ func (k Keeper) GetPoolBalances( } acc := k.ak.GetAccount(ctx, address) if acc == nil { - return nil, sdkerrors.Wrap(types.ErrReservePoolNotExists, escrowAddress) + return nil, errorsmod.Wrap(types.ErrReservePoolNotExists, escrowAddress) } return k.bk.GetAllBalances(ctx, acc.GetAddress()), nil } @@ -96,7 +96,7 @@ func (k Keeper) GetPoolBalancesByLptDenom( address := types.GetReservePoolAddr(lptDenom) acc := k.ak.GetAccount(ctx, address) if acc == nil { - return nil, sdkerrors.Wrap(types.ErrReservePoolNotExists, address.String()) + return nil, errorsmod.Wrap(types.ErrReservePoolNotExists, address.String()) } return k.bk.GetAllBalances(ctx, acc.GetAddress()), nil } @@ -109,7 +109,7 @@ func (k Keeper) GetLptDenomFromDenoms(ctx sdk.Context, denom1, denom2 string) (s standardDenom := k.GetStandardDenom(ctx) if denom1 != standardDenom && denom2 != standardDenom { - return "", sdkerrors.Wrap( + return "", errorsmod.Wrap( types.ErrNotContainStandardDenom, fmt.Sprintf( "standard denom: %s, denom1: %s, denom2: %s", @@ -127,7 +127,7 @@ func (k Keeper) GetLptDenomFromDenoms(ctx sdk.Context, denom1, denom2 string) (s poolId := types.GetPoolId(counterpartyDenom) pool, has := k.GetPool(ctx, poolId) if !has { - return "", sdkerrors.Wrapf( + return "", errorsmod.Wrapf( types.ErrReservePoolNotExists, "liquidity pool token: %s", counterpartyDenom, @@ -144,7 +144,7 @@ func (k Keeper) ValidatePool(ctx sdk.Context, lptDenom string) error { pool, has := k.GetPoolByLptDenom(ctx, lptDenom) if !has { - return sdkerrors.Wrapf(types.ErrReservePoolNotExists, "liquidity pool token: %s", lptDenom) + return errorsmod.Wrapf(types.ErrReservePoolNotExists, "liquidity pool token: %s", lptDenom) } _, err := k.GetPoolBalances(ctx, pool.EscrowAddress) diff --git a/modules/coinswap/keeper/swap.go b/modules/coinswap/keeper/swap.go index 3507ad49..1dd7c8c2 100644 --- a/modules/coinswap/keeper/swap.go +++ b/modules/coinswap/keeper/swap.go @@ -3,9 +3,9 @@ package keeper import ( "fmt" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/coinswap/types" ) @@ -28,7 +28,8 @@ func (k Keeper) swapCoins(ctx sdk.Context, sender, recipient sdk.AccAddress, coi return k.bk.SendCoins(ctx, poolAddr, recipient, sdk.NewCoins(coinBought)) } -/** +/* +* Calculate the amount of another token to be received based on the exact amount of tokens sold @param exactSoldCoin : sold coin @param soldTokenDenom : received token's denom @@ -50,10 +51,10 @@ func (k Keeper) calculateWithExactInput(ctx sdk.Context, exactSoldCoin sdk.Coin, outputReserve := reservePool.AmountOf(boughtTokenDenom) if !inputReserve.IsPositive() { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrInsufficientFunds, fmt.Sprintf("reserve pool insufficient funds, actual [%s%s]", inputReserve.String(), exactSoldCoin.Denom)) + return sdk.ZeroInt(), errorsmod.Wrap(types.ErrInsufficientFunds, fmt.Sprintf("reserve pool insufficient funds, actual [%s%s]", inputReserve.String(), exactSoldCoin.Denom)) } if !outputReserve.IsPositive() { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrInsufficientFunds, fmt.Sprintf("reserve pool insufficient funds, actual [%s%s]", outputReserve.String(), boughtTokenDenom)) + return sdk.ZeroInt(), errorsmod.Wrap(types.ErrInsufficientFunds, fmt.Sprintf("reserve pool insufficient funds, actual [%s%s]", outputReserve.String(), boughtTokenDenom)) } param := k.GetParams(ctx) @@ -61,7 +62,8 @@ func (k Keeper) calculateWithExactInput(ctx sdk.Context, exactSoldCoin sdk.Coin, return boughtTokenAmt, nil } -/** +/* +* Sell exact amount of a token for buying another, one of them must be standard token @param input: exact amount of the token to be sold @param output: min amount of the token to be bought @@ -77,7 +79,7 @@ func (k Keeper) TradeExactInputForOutput(ctx sdk.Context, input types.Input, out // assert that the calculated amount is more than the // minimum amount the buyer is willing to buy. if boughtTokenAmt.LT(output.Coin.Amount) { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", output.Coin.Denom, output.Coin.Amount.String(), boughtTokenAmt.String())) + return sdk.ZeroInt(), errorsmod.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", output.Coin.Denom, output.Coin.Amount.String(), boughtTokenAmt.String())) } boughtToken := sdk.NewCoin(output.Coin.Denom, boughtTokenAmt) @@ -96,7 +98,8 @@ func (k Keeper) TradeExactInputForOutput(ctx sdk.Context, input types.Input, out return boughtTokenAmt, nil } -/** +/* +* Sell exact amount of a token for buying another, non of them are standard token @param input: exact amount of the token to be sold @param output: min amount of the token to be bought @@ -133,7 +136,7 @@ func (k Keeper) doubleTradeExactInputForOutput(ctx sdk.Context, input types.Inpu // assert that the calculated amount is less than the // minimum amount the buyer is willing to buy. if boughtAmt.LT(output.Coin.Amount) { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", output.Coin.Denom, output.Coin.Amount.String(), boughtAmt.String())) + return sdk.ZeroInt(), errorsmod.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", output.Coin.Denom, output.Coin.Amount.String(), boughtAmt.String())) } if err := k.swapCoins(ctx, inputAddress, outputAddress, standardCoin, boughtToken); err != nil { @@ -142,7 +145,8 @@ func (k Keeper) doubleTradeExactInputForOutput(ctx sdk.Context, input types.Inpu return boughtAmt, nil } -/** +/* +* Calculate the amount of the token to be paid based on the exact amount of the token to be bought @param exactBoughtCoin @param soldTokenDenom @@ -164,13 +168,13 @@ func (k Keeper) calculateWithExactOutput(ctx sdk.Context, exactBoughtCoin sdk.Co inputReserve := reservePool.AmountOf(soldTokenDenom) if !inputReserve.IsPositive() { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrInsufficientFunds, fmt.Sprintf("reserve pool insufficient balance: [%s%s]", inputReserve.String(), soldTokenDenom)) + return sdk.ZeroInt(), errorsmod.Wrap(types.ErrInsufficientFunds, fmt.Sprintf("reserve pool insufficient balance: [%s%s]", inputReserve.String(), soldTokenDenom)) } if !outputReserve.IsPositive() { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrInsufficientFunds, fmt.Sprintf("reserve pool insufficient balance: [%s%s]", outputReserve.String(), exactBoughtCoin.Denom)) + return sdk.ZeroInt(), errorsmod.Wrap(types.ErrInsufficientFunds, fmt.Sprintf("reserve pool insufficient balance: [%s%s]", outputReserve.String(), exactBoughtCoin.Denom)) } if exactBoughtCoin.Amount.GTE(outputReserve) { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrInsufficientFunds, fmt.Sprintf("reserve pool insufficient balance of %s, user expected: %s, actual: %s", exactBoughtCoin.Denom, exactBoughtCoin.Amount.String(), outputReserve.String())) + return sdk.ZeroInt(), errorsmod.Wrap(types.ErrInsufficientFunds, fmt.Sprintf("reserve pool insufficient balance of %s, user expected: %s, actual: %s", exactBoughtCoin.Denom, exactBoughtCoin.Amount.String(), outputReserve.String())) } param := k.GetParams(ctx) @@ -178,7 +182,8 @@ func (k Keeper) calculateWithExactOutput(ctx sdk.Context, exactBoughtCoin sdk.Co return soldTokenAmt, nil } -/** +/* +* Buy exact amount of a token by specifying the max amount of another token, one of them must be standard token @param input : max amount of the token to be paid @param output : exact amount of the token to be bought @@ -194,7 +199,7 @@ func (k Keeper) TradeInputForExactOutput(ctx sdk.Context, input types.Input, out // assert that the calculated amount is less than the // max amount the buyer is willing to pay. if soldTokenAmt.GT(input.Coin.Amount) { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", input.Coin.Denom, input.Coin.Amount.String(), soldTokenAmt.String())) + return sdk.ZeroInt(), errorsmod.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", input.Coin.Denom, input.Coin.Amount.String(), soldTokenAmt.String())) } soldToken := sdk.NewCoin(input.Coin.Denom, soldTokenAmt) @@ -213,7 +218,8 @@ func (k Keeper) TradeInputForExactOutput(ctx sdk.Context, input types.Input, out return soldTokenAmt, nil } -/** +/* +* Buy exact amount of a token by specifying the max amount of another token, non of them are standard token @param input : max amount of the token to be paid @param output : exact amount of the token to be bought @@ -238,7 +244,7 @@ func (k Keeper) doubleTradeInputForExactOutput(ctx sdk.Context, input types.Inpu // assert that the calculated amount is less than the // max amount the buyer is willing to sell. if soldTokenAmt.GT(input.Coin.Amount) { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", input.Coin.Denom, input.Coin.Amount.String(), soldTokenAmt.String())) + return sdk.ZeroInt(), errorsmod.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", input.Coin.Denom, input.Coin.Amount.String(), soldTokenAmt.String())) } inputAddress, err := sdk.AccAddressFromBech32(input.Address) diff --git a/modules/coinswap/simulation/operations.go b/modules/coinswap/simulation/operations.go index c763ef8a..fa5905ae 100644 --- a/modules/coinswap/simulation/operations.go +++ b/modules/coinswap/simulation/operations.go @@ -8,12 +8,12 @@ import ( "strings" "time" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" @@ -972,7 +972,7 @@ func doubleSwapBill( outputReserve := reservePool.AmountOf(outputCoin.Denom) inputReserve := reservePool.AmountOf(standardDenom) if outputCoin.Amount.GTE(outputReserve) { - return sdk.Coin{}, sdk.Coin{}, sdkerrors.Wrap( + return sdk.Coin{}, sdk.Coin{}, errorsmod.Wrap( types.ErrConstraintNotMet, fmt.Sprintf( "insufficient amount of %s, user expected: %s, actual: %s", diff --git a/modules/coinswap/types/errors.go b/modules/coinswap/types/errors.go index e98cab2d..299f193f 100644 --- a/modules/coinswap/types/errors.go +++ b/modules/coinswap/types/errors.go @@ -1,17 +1,17 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // coinswap module sentinel errors var ( - ErrReservePoolNotExists = sdkerrors.Register(ModuleName, 2, "reserve pool not exists") - ErrEqualDenom = sdkerrors.Register(ModuleName, 3, "input and output denomination are equal") - ErrNotContainStandardDenom = sdkerrors.Register(ModuleName, 4, "must have one standard denom") - ErrMustStandardDenom = sdkerrors.Register(ModuleName, 5, "must be standard denom") - ErrInvalidDenom = sdkerrors.Register(ModuleName, 6, "invalid denom") - ErrInvalidDeadline = sdkerrors.Register(ModuleName, 7, "invalid deadline") - ErrConstraintNotMet = sdkerrors.Register(ModuleName, 8, "constraint not met") - ErrInsufficientFunds = sdkerrors.Register(ModuleName, 9, "insufficient funds") + ErrReservePoolNotExists = errorsmod.Register(ModuleName, 2, "reserve pool not exists") + ErrEqualDenom = errorsmod.Register(ModuleName, 3, "input and output denomination are equal") + ErrNotContainStandardDenom = errorsmod.Register(ModuleName, 4, "must have one standard denom") + ErrMustStandardDenom = errorsmod.Register(ModuleName, 5, "must be standard denom") + ErrInvalidDenom = errorsmod.Register(ModuleName, 6, "invalid denom") + ErrInvalidDeadline = errorsmod.Register(ModuleName, 7, "invalid deadline") + ErrConstraintNotMet = errorsmod.Register(ModuleName, 8, "constraint not met") + ErrInsufficientFunds = errorsmod.Register(ModuleName, 9, "insufficient funds") ) diff --git a/modules/coinswap/types/msgs.go b/modules/coinswap/types/msgs.go index e8c3b79a..368909c5 100644 --- a/modules/coinswap/types/msgs.go +++ b/modules/coinswap/types/msgs.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -75,7 +76,7 @@ func (msg MsgSwapOrder) ValidateBasic() error { } if msg.Input.Coin.Denom == msg.Output.Coin.Denom { - return sdkerrors.Wrap(ErrEqualDenom, "invalid swap") + return errorsmod.Wrap(ErrEqualDenom, "invalid swap") } return ValidateDeadline(msg.Deadline) @@ -142,7 +143,7 @@ func (msg MsgAddLiquidity) ValidateBasic() error { } if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } return nil } @@ -202,7 +203,7 @@ func (m MsgAddUnilateralLiquidity) ValidateBasic() error { } if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } return nil } @@ -265,7 +266,7 @@ func (msg MsgRemoveLiquidity) ValidateBasic() error { } if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } return nil } @@ -325,7 +326,7 @@ func (m MsgRemoveUnilateralLiquidity) ValidateBasic() error { } if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } return nil } @@ -352,7 +353,7 @@ func (m *MsgUpdateParams) GetSignBytes() []byte { // ValidateBasic executes sanity validation on the provided data func (m *MsgUpdateParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return sdkerrors.Wrap(err, "invalid authority address") + return errorsmod.Wrap(err, "invalid authority address") } return m.Params.Validate() } diff --git a/modules/coinswap/types/validation.go b/modules/coinswap/types/validation.go index 5ec3d7f1..6d5bb779 100644 --- a/modules/coinswap/types/validation.go +++ b/modules/coinswap/types/validation.go @@ -4,6 +4,7 @@ import ( fmt "fmt" "strings" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -12,15 +13,15 @@ import ( // ValidateInput verifies whether the given input is legal func ValidateInput(input Input) error { if !(input.Coin.IsValid() && input.Coin.IsPositive()) { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "invalid input (%s)", input.Coin.String()) + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid input (%s)", input.Coin.String()) } if strings.HasPrefix(input.Coin.Denom, LptTokenPrefix) { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid input denom, should not begin with (%s)", LptTokenPrefix) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid input denom, should not begin with (%s)", LptTokenPrefix) } if _, err := sdk.AccAddressFromBech32(input.Address); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid input address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid input address (%s)", err) } return nil } @@ -28,15 +29,15 @@ func ValidateInput(input Input) error { // ValidateOutput verifies whether the given output is legal func ValidateOutput(output Output) error { if !(output.Coin.IsValid() && output.Coin.IsPositive()) { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "invalid output (%s)", output.Coin.String()) + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid output (%s)", output.Coin.String()) } if strings.HasPrefix(output.Coin.Denom, LptTokenPrefix) { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid output denom, should not begin with (%s)", LptTokenPrefix) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid output denom, should not begin with (%s)", LptTokenPrefix) } if _, err := sdk.AccAddressFromBech32(output.Address); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid output address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid output address (%s)", err) } return nil } @@ -44,7 +45,7 @@ func ValidateOutput(output Output) error { // ValidateDeadline verifies whether the given deadline is legal func ValidateDeadline(deadline int64) error { if deadline <= 0 { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("deadline %d must be greater than 0", deadline)) + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("deadline %d must be greater than 0", deadline)) } return nil } @@ -52,11 +53,11 @@ func ValidateDeadline(deadline int64) error { // ValidateMaxToken verifies whether the maximum token is legal func ValidateMaxToken(maxToken sdk.Coin) error { if !(maxToken.IsValid() && maxToken.IsPositive()) { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "invalid maxToken (%s)", maxToken.String()) + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid maxToken (%s)", maxToken.String()) } if strings.HasPrefix(maxToken.Denom, LptTokenPrefix) { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "max token must be non-liquidity token") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "max token must be non-liquidity token") } return nil } @@ -64,11 +65,11 @@ func ValidateMaxToken(maxToken sdk.Coin) error { // ValidateToken verifies whether the exact token is legal func ValidateToken(exactToken sdk.Coin) error { if !(exactToken.IsValid() && exactToken.IsPositive()) { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "invalid exactToken (%s)", exactToken.String()) + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid exactToken (%s)", exactToken.String()) } if strings.HasPrefix(exactToken.Denom, LptTokenPrefix) { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "token must be non-liquidity token") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "token must be non-liquidity token") } return nil } @@ -76,7 +77,7 @@ func ValidateToken(exactToken sdk.Coin) error { // ValidateCounterpartyDenom verifies whether the counterparty denom is legal func ValidateCounterpartyDenom(counterpartydenom string) error { if counterpartydenom == "" { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "counterparty denom should not be empty") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "counterparty denom should not be empty") } return nil } @@ -84,7 +85,7 @@ func ValidateCounterpartyDenom(counterpartydenom string) error { // ValidateExactStandardAmt verifies whether the standard token amount is legal func ValidateExactStandardAmt(standardAmt sdkmath.Int) error { if !standardAmt.IsPositive() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "standard token amount must be positive") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "standard token amount must be positive") } return nil } @@ -92,7 +93,7 @@ func ValidateExactStandardAmt(standardAmt sdkmath.Int) error { // ValidateLiquidity verifies whether the minimum liquidity is legal func ValidateLiquidity(minLiquidity sdkmath.Int) error { if minLiquidity.IsNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "liquidity can not be negative") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "liquidity can not be negative") } return nil } @@ -100,7 +101,7 @@ func ValidateLiquidity(minLiquidity sdkmath.Int) error { // ValidateMinToken verifies whether the minimum token amount is legal func ValidateMinToken(minToken sdkmath.Int) error { if minToken.IsNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "minimum token amount can not be negative") + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, "minimum token amount can not be negative") } return nil } @@ -108,7 +109,7 @@ func ValidateMinToken(minToken sdkmath.Int) error { // ValidateWithdrawLiquidity verifies whether the given liquidity is legal func ValidateWithdrawLiquidity(liquidity sdk.Coin) error { if !liquidity.IsValid() || !liquidity.IsPositive() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "invalid withdrawLiquidity (%s)", liquidity.String()) + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid withdrawLiquidity (%s)", liquidity.String()) } if err := ValidateLptDenom(liquidity.Denom); err != nil { @@ -120,7 +121,7 @@ func ValidateWithdrawLiquidity(liquidity sdk.Coin) error { // ValidateMinStandardAmt verifies whether the minimum standard amount is legal func ValidateMinStandardAmt(minStandardAmt sdkmath.Int) error { if minStandardAmt.IsNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("minimum standard token amount %s can not be negative", minStandardAmt.String())) + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("minimum standard token amount %s can not be negative", minStandardAmt.String())) } return nil } @@ -128,7 +129,7 @@ func ValidateMinStandardAmt(minStandardAmt sdkmath.Int) error { // ValidateLptDenom returns nil if the Liquidity pool token denom is valid func ValidateLptDenom(lptDenom string) error { if _, err := ParseLptDenom(lptDenom); err != nil { - return sdkerrors.Wrap(ErrInvalidDenom, lptDenom) + return errorsmod.Wrap(ErrInvalidDenom, lptDenom) } return nil } @@ -136,7 +137,7 @@ func ValidateLptDenom(lptDenom string) error { // ValidatePoolSequenceId returns nil if the pool id is valid func ValidatePoolSequenceId(poolId uint64) error { if poolId == 0 { - return sdkerrors.Wrap(ErrReservePoolNotExists, "pool-id is not valid") + return errorsmod.Wrap(ErrReservePoolNotExists, "pool-id is not valid") } return nil } diff --git a/modules/farm/handler.go b/modules/farm/handler.go index 65b1b9f0..b8b633b8 100644 --- a/modules/farm/handler.go +++ b/modules/farm/handler.go @@ -1,6 +1,7 @@ package farm import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -40,7 +41,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } } } @@ -52,7 +53,7 @@ func NewCommunityPoolCreateFarmProposalHandler(k keeper.Keeper) govv1beta1.Handl return k.HandleCreateFarmProposal(ctx, c) default: - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized farm proposal content type: %T", c) + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized farm proposal content type: %T", c) } } } diff --git a/modules/farm/keeper/farmer.go b/modules/farm/keeper/farmer.go index 4bea0f0c..659b4d71 100644 --- a/modules/farm/keeper/farmer.go +++ b/modules/farm/keeper/farmer.go @@ -1,6 +1,7 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -16,11 +17,11 @@ func (k Keeper) Stake( ) (reward sdk.Coins, err error) { pool, exist := k.GetPool(ctx, poolId) if !exist { - return reward, sdkerrors.Wrapf(types.ErrPoolNotFound, poolId) + return reward, errorsmod.Wrapf(types.ErrPoolNotFound, poolId) } if pool.StartHeight > ctx.BlockHeight() { - return reward, sdkerrors.Wrapf( + return reward, errorsmod.Wrapf( types.ErrPoolNotStart, "farm pool [%s] will start at height [%d], current [%d]", poolId, pool.StartHeight, ctx.BlockHeight(), @@ -28,7 +29,7 @@ func (k Keeper) Stake( } if k.Expired(ctx, pool) { - return reward, sdkerrors.Wrapf( + return reward, errorsmod.Wrapf( types.ErrPoolExpired, "pool [%s] has expired at height [%d], current [%d]", poolId, pool.EndHeight, ctx.BlockHeight(), @@ -36,7 +37,7 @@ func (k Keeper) Stake( } if lpToken.Denom != pool.TotalLptLocked.Denom { - return reward, sdkerrors.Wrapf( + return reward, errorsmod.Wrapf( types.ErrNotMatch, "pool [%s] only accept [%s] token, but got [%s]", poolId, pool.TotalLptLocked.Denom, lpToken.Denom, @@ -81,12 +82,12 @@ func (k Keeper) Stake( func (k Keeper) Unstake(ctx sdk.Context, poolId string, lpToken sdk.Coin, sender sdk.AccAddress) (_ sdk.Coins, err error) { pool, exist := k.GetPool(ctx, poolId) if !exist { - return nil, sdkerrors.Wrapf(types.ErrPoolNotFound, poolId) + return nil, errorsmod.Wrapf(types.ErrPoolNotFound, poolId) } //lpToken demon must be same as pool.TotalLptLocked.Denom if lpToken.Denom != pool.TotalLptLocked.Denom { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrNotMatch, "pool [%s] only accept [%s] token, but got [%s]", poolId, pool.TotalLptLocked.Denom, lpToken.Denom, @@ -96,7 +97,7 @@ func (k Keeper) Unstake(ctx sdk.Context, poolId string, lpToken sdk.Coin, sender //farmInfo must be exist farmInfo, exist := k.GetFarmInfo(ctx, poolId, sender.String()) if !exist { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrFarmerNotFound, "farmer [%s] not found in pool [%s]", sender.String(), poolId, @@ -105,7 +106,7 @@ func (k Keeper) Unstake(ctx sdk.Context, poolId string, lpToken sdk.Coin, sender //the lp token unstaked must be less than staked if farmInfo.Locked.LT(lpToken.Amount) { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInsufficientFunds, "farmer locked lp token [%s], but unstake [%s]", farmInfo.Locked.String(), lpToken.Amount.String(), @@ -114,7 +115,7 @@ func (k Keeper) Unstake(ctx sdk.Context, poolId string, lpToken sdk.Coin, sender //the lp token unstaked must be less than pool if pool.TotalLptLocked.Amount.LT(lpToken.Amount) { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInsufficientFunds, "farmer locked lp token [%s], but farm pool total: [%s]", farmInfo.Locked.String(), pool.TotalLptLocked.Amount.String(), @@ -162,11 +163,11 @@ func (k Keeper) Unstake(ctx sdk.Context, poolId string, lpToken sdk.Coin, sender func (k Keeper) Harvest(ctx sdk.Context, poolId string, sender sdk.AccAddress) (sdk.Coins, error) { pool, exist := k.GetPool(ctx, poolId) if !exist { - return nil, sdkerrors.Wrapf(types.ErrPoolNotFound, poolId) + return nil, errorsmod.Wrapf(types.ErrPoolNotFound, poolId) } if k.Expired(ctx, pool) { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrPoolExpired, "pool [%s] has expired at height [%d], current [%d]", poolId, pool.EndHeight, ctx.BlockHeight(), @@ -175,7 +176,7 @@ func (k Keeper) Harvest(ctx sdk.Context, poolId string, sender sdk.AccAddress) ( farmInfo, exist := k.GetFarmInfo(ctx, poolId, sender.String()) if !exist { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrFarmerNotFound, "farmer [%s] not found in pool [%s]", sender.String(), poolId, @@ -224,7 +225,7 @@ func (k Keeper) Refund(ctx sdk.Context, pool types.FarmPool) (sdk.Coins, error) } if !refundTotal.IsAllPositive() { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidRefund, "pool [%s] has no remaining reward", pool.Id, diff --git a/modules/farm/keeper/fees.go b/modules/farm/keeper/fees.go index feb6bf19..ac4d2f10 100644 --- a/modules/farm/keeper/fees.go +++ b/modules/farm/keeper/fees.go @@ -1,4 +1,4 @@ -//nolint +// nolint package keeper import ( diff --git a/modules/farm/keeper/grpc_query.go b/modules/farm/keeper/grpc_query.go index 97ef80f0..8c64acd3 100644 --- a/modules/farm/keeper/grpc_query.go +++ b/modules/farm/keeper/grpc_query.go @@ -3,12 +3,12 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" "github.com/irisnet/irismod/modules/farm/types" @@ -70,7 +70,7 @@ func (k Keeper) FarmPool(goctx context.Context, pool, exist := k.GetPool(ctx, request.Id) if !exist { - return nil, sdkerrors.Wrapf(types.ErrPoolNotFound, request.Id) + return nil, errorsmod.Wrapf(types.ErrPoolNotFound, request.Id) } var totalReward sdk.Coins @@ -116,13 +116,13 @@ func (k Keeper) Farmer(goctx context.Context, request *types.QueryFarmerRequest) } } if len(farmInfos) == 0 { - return nil, sdkerrors.Wrapf(types.ErrFarmerNotFound, "not found farmer: %s", request.Farmer) + return nil, errorsmod.Wrapf(types.ErrFarmerNotFound, "not found farmer: %s", request.Farmer) } for _, farmer := range farmInfos { pool, exist := k.GetPool(cacheCtx, farmer.PoolId) if !exist { - return nil, sdkerrors.Wrapf(types.ErrPoolNotFound, farmer.PoolId) + return nil, errorsmod.Wrapf(types.ErrPoolNotFound, farmer.PoolId) } //The farm pool has not started, no reward diff --git a/modules/farm/keeper/msg_server.go b/modules/farm/keeper/msg_server.go index 54d0ff9d..4d950f68 100644 --- a/modules/farm/keeper/msg_server.go +++ b/modules/farm/keeper/msg_server.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + errorsmod "cosmossdk.io/errors" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -36,7 +37,7 @@ func (m msgServer) CreatePool( ctx := sdk.UnwrapSDKContext(goCtx) //check valid begin height if ctx.BlockHeight() > int64(msg.StartHeight) { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrExpiredHeight, "The current block height[%d] is greater than StartHeight[%d]", ctx.BlockHeight(), msg.StartHeight, @@ -46,7 +47,7 @@ func (m msgServer) CreatePool( if maxRewardCategories := m.k.MaxRewardCategories(ctx); uint32( len(msg.TotalReward), ) > maxRewardCategories { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidRewardRule, "the max reward category num is [%d], but got [%d]", maxRewardCategories, len(msg.TotalReward), @@ -55,7 +56,7 @@ func (m msgServer) CreatePool( //check valid lp token denom if err := m.k.ck.ValidatePool(ctx, msg.LptDenom); err != nil { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidLPToken, "The lp token denom[%s] is not exist", msg.LptDenom, @@ -98,7 +99,7 @@ func (m msgServer) CreatePoolWithCommunityPool( totalReward := sdk.NewCoins(msg.Content.FundApplied...).Add(msg.Content.FundSelfBond...) maxRewardCategories := m.k.MaxRewardCategories(ctx) if uint32(len(totalReward)) > maxRewardCategories { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidRewardRule, "the max reward category num is [%d], but got [%d]", maxRewardCategories, len(totalReward), @@ -107,7 +108,7 @@ func (m msgServer) CreatePoolWithCommunityPool( //check valid lp token denom if err := m.k.ck.ValidatePool(ctx, msg.Content.LptDenom); err != nil { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidLPToken, "The lp token denom[%s] is not exist", msg.Content.LptDenom, @@ -310,7 +311,7 @@ func (m msgServer) UpdateParams( msg *types.MsgUpdateParams, ) (*types.MsgUpdateParamsResponse, error) { if m.k.authority != msg.Authority { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrUnauthorized, "invalid authority; expected %s, got %s", m.k.authority, diff --git a/modules/farm/keeper/pool.go b/modules/farm/keeper/pool.go index 05ff8599..cbfed82c 100644 --- a/modules/farm/keeper/pool.go +++ b/modules/farm/keeper/pool.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -36,20 +37,20 @@ func (k Keeper) CreatePool( func (k Keeper) DestroyPool(ctx sdk.Context, poolId string, creator sdk.AccAddress) (sdk.Coins, error) { pool, exist := k.GetPool(ctx, poolId) if !exist { - return nil, sdkerrors.Wrapf(types.ErrPoolNotFound, poolId) + return nil, errorsmod.Wrapf(types.ErrPoolNotFound, poolId) } if creator.String() != pool.Creator { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "creator [%s] is not the creator of the pool", creator.String()) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "creator [%s] is not the creator of the pool", creator.String()) } if !pool.Editable { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidOperate, "pool [%s] is not editable", poolId) } if k.Expired(ctx, pool) { - return nil, sdkerrors.Wrapf(types.ErrPoolExpired, + return nil, errorsmod.Wrapf(types.ErrPoolExpired, "pool [%s] has expired at height [%d], current [%d]", poolId, pool.EndHeight, @@ -70,22 +71,22 @@ func (k Keeper) AdjustPool( pool, exist := k.GetPool(ctx, poolId) //check if the liquidity pool exists if !exist { - return sdkerrors.Wrapf(types.ErrPoolNotFound, poolId) + return errorsmod.Wrapf(types.ErrPoolNotFound, poolId) } if !pool.Editable { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidOperate, "pool [%s] is not editable", poolId) } //check permissions if creator.String() != pool.Creator { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "creator [%s] is not the creator of the pool", creator.String()) + return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "creator [%s] is not the creator of the pool", creator.String()) } //check for expiration if k.Expired(ctx, pool) { - return sdkerrors.Wrapf(types.ErrPoolExpired, + return errorsmod.Wrapf(types.ErrPoolExpired, "pool [%s] has expired at height[%d], current [%d]", poolId, pool.EndHeight, @@ -96,11 +97,11 @@ func (k Keeper) AdjustPool( pool.Rules = k.GetRewardRules(ctx, pool.Id) rules := types.RewardRules(pool.Rules) if rewardPerBlock != nil && !rewardPerBlock.DenomsSubsetOf(rules.RewardsPerBlock()) { - return sdkerrors.Wrapf(types.ErrInvalidAppend, "rewardPerBlock: %s", rewardPerBlock.String()) + return errorsmod.Wrapf(types.ErrInvalidAppend, "rewardPerBlock: %s", rewardPerBlock.String()) } if reward != nil && !rules.Contains(reward) { - return sdkerrors.Wrapf(types.ErrInvalidAppend, reward.String()) + return errorsmod.Wrapf(types.ErrInvalidAppend, reward.String()) } startHeight := pool.StartHeight @@ -228,7 +229,7 @@ func (k Keeper) updatePool( ) (types.FarmPool, sdk.Coins, error) { height := ctx.BlockHeight() if height < pool.LastHeightDistrRewards { - return pool, nil, sdkerrors.Wrapf( + return pool, nil, errorsmod.Wrapf( types.ErrExpiredHeight, "invalid height: [%d], last distribution height: [%d]", height, pool.LastHeightDistrRewards, @@ -237,7 +238,7 @@ func (k Keeper) updatePool( rules := k.GetRewardRules(ctx, pool.Id) if len(rules) == 0 { - return pool, nil, sdkerrors.Wrapf(types.ErrPoolNotFound, pool.Id) + return pool, nil, errorsmod.Wrapf(types.ErrPoolNotFound, pool.Id) } var rewardTotal sdk.Coins //when there are multiple farm operations in the same block, the value needs to be updated once @@ -254,7 +255,7 @@ func (k Keeper) updatePool( "remainingReward", rules[i].RemainingReward.String(), "rewardCollected", rewardCollected.String(), ) - return pool, nil, sdkerrors.Wrapf( + return pool, nil, errorsmod.Wrapf( sdkerrors.ErrInsufficientFunds, "the remaining reward of the pool [%s] is [%s], but got [%s]", pool.Id, sdk.NewCoin(rules[i].Reward, rules[i].RemainingReward).String(), coinCollected, diff --git a/modules/farm/keeper/proposal_hook.go b/modules/farm/keeper/proposal_hook.go index 0ec06f09..b5923fd9 100644 --- a/modules/farm/keeper/proposal_hook.go +++ b/modules/farm/keeper/proposal_hook.go @@ -2,21 +2,22 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) -var _ govtypes.GovHooks = GovHook{} - +// GovHook implements govtypes.GovHooks type GovHook struct { k Keeper } +// NewGovHook returns a new GovHook instance. +// +// It takes a parameter of type Keeper and returns a GovHook. func NewGovHook(k Keeper) GovHook { return GovHook{k} } -//AfterProposalFailedMinDeposit callback when the proposal is deleted due to insufficient collateral +// AfterProposalFailedMinDeposit callback when the proposal is deleted due to insufficient collateral func (h GovHook) AfterProposalFailedMinDeposit(ctx sdk.Context, proposalID uint64) { info, has := h.k.GetEscrowInfo(ctx, proposalID) if !has { @@ -26,7 +27,7 @@ func (h GovHook) AfterProposalFailedMinDeposit(ctx sdk.Context, proposalID uint6 h.k.refundEscrow(ctx, info) } -//AfterProposalVotingPeriodEnded callback when proposal voting is complete +// AfterProposalVotingPeriodEnded callback when proposal voting is complete func (h GovHook) AfterProposalVotingPeriodEnded(ctx sdk.Context, proposalID uint64) { info, has := h.k.GetEscrowInfo(ctx, proposalID) if !has { @@ -48,7 +49,18 @@ func (h GovHook) AfterProposalVotingPeriodEnded(ctx sdk.Context, proposalID uint h.k.refundEscrow(ctx, info) } +// AfterProposalSubmission description of the Go function. +// +// Takes in sdk.Context and uint64 as parameters. func (h GovHook) AfterProposalSubmission(ctx sdk.Context, proposalID uint64) {} + +// AfterProposalDeposit is a function that... +// +// takes in ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress. func (h GovHook) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) { } + +// AfterProposalVote is a Go function. +// +// It takes parameters ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress. func (h GovHook) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) {} diff --git a/modules/farm/types/errors.go b/modules/farm/types/errors.go index ce876fcf..b4ca9bdc 100644 --- a/modules/farm/types/errors.go +++ b/modules/farm/types/errors.go @@ -1,26 +1,27 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // farm module sentinel errors var ( - ErrExpiredHeight = sdkerrors.Register(ModuleName, 2, "expired block height") - ErrInvalidLPToken = sdkerrors.Register(ModuleName, 3, "invalid lp token denom") - ErrNotMatch = sdkerrors.Register(ModuleName, 4, "the data does not match") - ErrPoolExpired = sdkerrors.Register(ModuleName, 5, "the farm pool has expired") - ErrPoolNotStart = sdkerrors.Register(ModuleName, 6, "the farm pool don't start") - ErrPoolExist = sdkerrors.Register(ModuleName, 7, "the farm pool already exist") - ErrPoolNotFound = sdkerrors.Register(ModuleName, 8, "the farm pool does not exist") - ErrInvalidOperate = sdkerrors.Register(ModuleName, 9, "invalid operate") - ErrFarmerNotFound = sdkerrors.Register(ModuleName, 10, "the farmer does not exist") - ErrInvalidPoolId = sdkerrors.Register(ModuleName, 11, "invalid pool id") - ErrInvalidDescription = sdkerrors.Register(ModuleName, 12, "invalid pool description, length must be less than or equal to 280") - ErrInvalidAppend = sdkerrors.Register(ModuleName, 13, "cannot add new token as a reward") - ErrInvalidRewardRule = sdkerrors.Register(ModuleName, 14, "invalid reward rule") - ErrAllEmpty = sdkerrors.Register(ModuleName, 15, "shouldn't all be empty") - ErrBadDistribution = sdkerrors.Register(ModuleName, 16, "community pool does not have sufficient coins to distribute") - ErrInvalidRefund = sdkerrors.Register(ModuleName, 17, "invalid refund amount") - ErrInvalidProposal = sdkerrors.Register(ModuleName, 18, "invalid proposal") + ErrExpiredHeight = errorsmod.Register(ModuleName, 2, "expired block height") + ErrInvalidLPToken = errorsmod.Register(ModuleName, 3, "invalid lp token denom") + ErrNotMatch = errorsmod.Register(ModuleName, 4, "the data does not match") + ErrPoolExpired = errorsmod.Register(ModuleName, 5, "the farm pool has expired") + ErrPoolNotStart = errorsmod.Register(ModuleName, 6, "the farm pool don't start") + ErrPoolExist = errorsmod.Register(ModuleName, 7, "the farm pool already exist") + ErrPoolNotFound = errorsmod.Register(ModuleName, 8, "the farm pool does not exist") + ErrInvalidOperate = errorsmod.Register(ModuleName, 9, "invalid operate") + ErrFarmerNotFound = errorsmod.Register(ModuleName, 10, "the farmer does not exist") + ErrInvalidPoolId = errorsmod.Register(ModuleName, 11, "invalid pool id") + ErrInvalidDescription = errorsmod.Register(ModuleName, 12, "invalid pool description, length must be less than or equal to 280") + ErrInvalidAppend = errorsmod.Register(ModuleName, 13, "cannot add new token as a reward") + ErrInvalidRewardRule = errorsmod.Register(ModuleName, 14, "invalid reward rule") + ErrAllEmpty = errorsmod.Register(ModuleName, 15, "shouldn't all be empty") + ErrBadDistribution = errorsmod.Register(ModuleName, 16, "community pool does not have sufficient coins to distribute") + ErrInvalidRefund = errorsmod.Register(ModuleName, 17, "invalid refund amount") + ErrInvalidProposal = errorsmod.Register(ModuleName, 18, "invalid proposal") + ErrEscrowInfoNotFound = errorsmod.Register(ModuleName, 19, "the escrow information does not exist") ) diff --git a/modules/farm/types/farm.go b/modules/farm/types/farm.go index b5d43463..ebd4e47a 100644 --- a/modules/farm/types/farm.go +++ b/modules/farm/types/farm.go @@ -3,6 +3,7 @@ package types import ( math "math" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -20,7 +21,7 @@ func (pool FarmPool) ExpiredHeight() (int64, error) { } } if int64(math.MaxInt64)-pool.StartHeight < targetInteval { - return 0, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "endheight overflow") + return 0, errorsmod.Wrapf(sdkerrors.ErrInvalidHeight, "endheight overflow") } return pool.StartHeight + targetInteval, nil } diff --git a/modules/farm/types/genesis.go b/modules/farm/types/genesis.go index 4e35fbbd..1b6185a7 100644 --- a/modules/farm/types/genesis.go +++ b/modules/farm/types/genesis.go @@ -6,16 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -var ( - defaultGenesisState = GenesisState{ - Params: Params{ - PoolCreationFee: DefaultPoolCreationFee, - TaxRate: DefaulttTaxRate, - MaxRewardCategories: DefaultMaxRewardCategories, - }, - } -) - // NewGenesisState constructs a new GenesisState instance func NewGenesisState(params Params, pools []FarmPool, farmInfos []FarmInfo, sequence uint64, escrow []EscrowInfo) *GenesisState { return &GenesisState{ @@ -25,11 +15,9 @@ func NewGenesisState(params Params, pools []FarmPool, farmInfos []FarmInfo, sequ // DefaultGenesisState gets the default genesis state for testing func DefaultGenesisState() *GenesisState { - return &defaultGenesisState -} - -func SetDefaultGenesisState(state GenesisState) { - defaultGenesisState = state + return &GenesisState{ + Params: DefaultParams(), + } } // ValidateGenesis validates the provided farm genesis state to ensure the diff --git a/modules/farm/types/msgs.go b/modules/farm/types/msgs.go index 7eec6a8f..1d390883 100644 --- a/modules/farm/types/msgs.go +++ b/modules/farm/types/msgs.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -94,10 +95,10 @@ func (msg MsgCreatePoolWithCommunityPool) Type() string { return TypeMsgCreatePr // ValidateBasic implements Msg func (msg MsgCreatePoolWithCommunityPool) ValidateBasic() error { if !msg.InitialDeposit.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) } if msg.InitialDeposit.IsAnyNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) } if err := ValidateAddress(msg.Proposer); err != nil { return err @@ -165,7 +166,7 @@ func (msg MsgAdjustPool) ValidateBasic() error { } if msg.AdditionalReward == nil && msg.RewardPerBlock == nil { - return sdkerrors.Wrap(ErrAllEmpty, "AdditionalReward and RewardPerBlock") + return errorsmod.Wrap(ErrAllEmpty, "AdditionalReward and RewardPerBlock") } if msg.AdditionalReward != nil { @@ -318,7 +319,7 @@ func (m *MsgUpdateParams) GetSignBytes() []byte { // ValidateBasic executes sanity validation on the provided data func (m *MsgUpdateParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return sdkerrors.Wrap(err, "invalid authority address") + return errorsmod.Wrap(err, "invalid authority address") } return m.Params.Validate() } diff --git a/modules/farm/types/params.go b/modules/farm/types/params.go index d6ff9475..ee8efb10 100644 --- a/modules/farm/types/params.go +++ b/modules/farm/types/params.go @@ -8,13 +8,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// Farm params default values -var ( - DefaultPoolCreationFee = sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(5000)) // 5000stake - DefaulttTaxRate = sdk.NewDecWithPrec(4, 1) // 0.4 (40%) - DefaultMaxRewardCategories = uint32(2) -) - // NewParams creates a new Params instance func NewParams(createPoolFee sdk.Coin, maxRewardCategories uint32, taxRate sdk.Dec) Params { return Params{ @@ -26,7 +19,11 @@ func NewParams(createPoolFee sdk.Coin, maxRewardCategories uint32, taxRate sdk.D // DefaultParams returns a default set of parameters. func DefaultParams() Params { - return NewParams(DefaultPoolCreationFee, DefaultMaxRewardCategories, DefaulttTaxRate) + return NewParams( + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(5000)), + 2, + sdk.NewDecWithPrec(4, 1), + ) } // Validate validates a set of params diff --git a/modules/farm/types/validation.go b/modules/farm/types/validation.go index e90f85a5..2eea1e5a 100644 --- a/modules/farm/types/validation.go +++ b/modules/farm/types/validation.go @@ -4,6 +4,7 @@ import ( "strconv" "strings" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -26,7 +27,7 @@ func ValidatepPoolId(poolId string) (uint64, error) { // ValidateDescription validates the pool name func ValidateDescription(description string) error { if len(description) > MaxDescriptionLength { - return sdkerrors.Wrap(ErrInvalidDescription, description) + return errorsmod.Wrap(ErrInvalidDescription, description) } return nil } @@ -39,7 +40,7 @@ func ValidateLpTokenDenom(denom string) error { // ValidateCoins validates the coin func ValidateCoins(field string, coins ...sdk.Coin) error { if len(coins) == 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "The %s should be greater than zero", field) + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "The %s should be greater than zero", field) } return sdk.NewCoins(coins...).Validate() } @@ -53,21 +54,21 @@ func ValidateAddress(sender string) error { // ValidateReward validates the coin func ValidateReward(rewardPerBlock, totalReward sdk.Coins) error { if len(rewardPerBlock) != len(totalReward) { - return sdkerrors.Wrapf(ErrNotMatch, "The length of rewardPerBlock and totalReward must be the same") + return errorsmod.Wrapf(ErrNotMatch, "The length of rewardPerBlock and totalReward must be the same") } if !rewardPerBlock.DenomsSubsetOf(totalReward) { - return sdkerrors.Wrapf(ErrInvalidRewardRule, "rewardPerBlock and totalReward token types must be the same") + return errorsmod.Wrapf(ErrInvalidRewardRule, "rewardPerBlock and totalReward token types must be the same") } for i := range totalReward { if !totalReward[i].IsGTE(rewardPerBlock[i]) { - return sdkerrors.Wrapf(ErrNotMatch, "The totalReward should be greater than or equal to rewardPerBlock") + return errorsmod.Wrapf(ErrNotMatch, "The totalReward should be greater than or equal to rewardPerBlock") } //uint64 overflow check h := totalReward[i].Amount.Quo(rewardPerBlock[i].Amount) if !h.IsInt64() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Can not convert to int64, overflow") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "Can not convert to int64, overflow") } } return nil @@ -79,12 +80,12 @@ func ValidateFund(rewardPerBlock, fundApplied, fundSelfBond []sdk.Coin) error { } if err := sdk.NewCoins(fundSelfBond...).Validate(); err != nil { - return sdkerrors.Wrapf(err, "The fundSelfBond is invalid coin") + return errorsmod.Wrapf(err, "The fundSelfBond is invalid coin") } total := sdk.NewCoins(fundApplied...).Add(fundSelfBond...) if len(fundApplied)+len(fundSelfBond) != total.Len() { - return sdkerrors.Wrapf(ErrInvalidProposal, "the type of The token bond by the user cannot be the same as the one applied for community pool") + return errorsmod.Wrapf(ErrInvalidProposal, "the type of The token bond by the user cannot be the same as the one applied for community pool") } return ValidateReward(rewardPerBlock, total) } diff --git a/modules/htlc/handler.go b/modules/htlc/handler.go index 8394439d..46217422 100644 --- a/modules/htlc/handler.go +++ b/modules/htlc/handler.go @@ -1,6 +1,7 @@ package htlc import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -25,7 +26,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } } } diff --git a/modules/htlc/keeper/asset.go b/modules/htlc/keeper/asset.go index 265b5401..88217b86 100644 --- a/modules/htlc/keeper/asset.go +++ b/modules/htlc/keeper/asset.go @@ -5,8 +5,8 @@ import ( gogotypes "github.com/cosmos/gogoproto/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/htlc/types" ) @@ -15,7 +15,7 @@ import ( func (k Keeper) IncrementCurrentAssetSupply(ctx sdk.Context, coin sdk.Coin) error { supply, found := k.GetAssetSupply(ctx, coin.Denom) if !found { - return sdkerrors.Wrap(types.ErrAssetNotSupported, coin.Denom) + return errorsmod.Wrap(types.ErrAssetNotSupported, coin.Denom) } limit, err := k.GetSupplyLimit(ctx, coin.Denom) @@ -26,7 +26,7 @@ func (k Keeper) IncrementCurrentAssetSupply(ctx sdk.Context, coin sdk.Coin) erro // Resulting current supply must be under asset's limit if supplyLimit.IsLT(supply.CurrentSupply.Add(coin)) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrExceedsSupplyLimit, "increase %s, asset supply %s, limit %s", coin, supply.CurrentSupply, supplyLimit, @@ -36,7 +36,7 @@ func (k Keeper) IncrementCurrentAssetSupply(ctx sdk.Context, coin sdk.Coin) erro if limit.TimeLimited { timeBasedSupplyLimit := sdk.NewCoin(coin.Denom, limit.TimeBasedLimit) if timeBasedSupplyLimit.IsLT(supply.TimeLimitedCurrentSupply.Add(coin)) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrExceedsTimeBasedSupplyLimit, "increase %s, current time-based asset supply %s, limit %s", coin, supply.TimeLimitedCurrentSupply, timeBasedSupplyLimit, @@ -54,13 +54,13 @@ func (k Keeper) IncrementCurrentAssetSupply(ctx sdk.Context, coin sdk.Coin) erro func (k Keeper) DecrementCurrentAssetSupply(ctx sdk.Context, coin sdk.Coin) error { supply, found := k.GetAssetSupply(ctx, coin.Denom) if !found { - return sdkerrors.Wrap(types.ErrAssetNotSupported, coin.Denom) + return errorsmod.Wrap(types.ErrAssetNotSupported, coin.Denom) } // Resulting current supply must be greater than or equal to 0 // Use sdk.Int instead of sdk.Coin to prevent panic if true if supply.CurrentSupply.Amount.Sub(coin.Amount).IsNegative() { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidCurrentSupply, "decrease %s, asset supply %s", coin, @@ -77,7 +77,7 @@ func (k Keeper) DecrementCurrentAssetSupply(ctx sdk.Context, coin sdk.Coin) erro func (k Keeper) IncrementIncomingAssetSupply(ctx sdk.Context, coin sdk.Coin) error { supply, found := k.GetAssetSupply(ctx, coin.Denom) if !found { - return sdkerrors.Wrap(types.ErrAssetNotSupported, coin.Denom) + return errorsmod.Wrap(types.ErrAssetNotSupported, coin.Denom) } // Result of (current + incoming + amount) must be under asset's limit @@ -89,7 +89,7 @@ func (k Keeper) IncrementIncomingAssetSupply(ctx sdk.Context, coin sdk.Coin) err } supplyLimit := sdk.NewCoin(coin.Denom, limit.Limit) if supplyLimit.IsLT(totalSupply.Add(coin)) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrExceedsSupplyLimit, "increase %s, asset supply %s, limit %s", coin, @@ -102,7 +102,7 @@ func (k Keeper) IncrementIncomingAssetSupply(ctx sdk.Context, coin sdk.Coin) err timeLimitedTotalSupply := supply.TimeLimitedCurrentSupply.Add(supply.IncomingSupply) timeBasedSupplyLimit := sdk.NewCoin(coin.Denom, limit.TimeBasedLimit) if timeBasedSupplyLimit.IsLT(timeLimitedTotalSupply.Add(coin)) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrExceedsTimeBasedSupplyLimit, "increase %s, time-based asset supply %s, limit %s", coin, supply.TimeLimitedCurrentSupply, timeBasedSupplyLimit, @@ -119,13 +119,13 @@ func (k Keeper) IncrementIncomingAssetSupply(ctx sdk.Context, coin sdk.Coin) err func (k Keeper) DecrementIncomingAssetSupply(ctx sdk.Context, coin sdk.Coin) error { supply, found := k.GetAssetSupply(ctx, coin.Denom) if !found { - return sdkerrors.Wrap(types.ErrAssetNotSupported, coin.Denom) + return errorsmod.Wrap(types.ErrAssetNotSupported, coin.Denom) } // Resulting incoming supply must be greater than or equal to 0 // Use sdk.Int instead of sdk.Coin to prevent panic if true if supply.IncomingSupply.Amount.Sub(coin.Amount).IsNegative() { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidIncomingSupply, "decrease %s, incoming supply %s", coin, @@ -142,12 +142,12 @@ func (k Keeper) DecrementIncomingAssetSupply(ctx sdk.Context, coin sdk.Coin) err func (k Keeper) IncrementOutgoingAssetSupply(ctx sdk.Context, coin sdk.Coin) error { supply, found := k.GetAssetSupply(ctx, coin.Denom) if !found { - return sdkerrors.Wrap(types.ErrAssetNotSupported, coin.Denom) + return errorsmod.Wrap(types.ErrAssetNotSupported, coin.Denom) } // Result of (outgoing + amount) must be less than current supply if supply.CurrentSupply.IsLT(supply.OutgoingSupply.Add(coin)) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrExceedsAvailableSupply, "swap amount %s, available supply %s", coin, supply.CurrentSupply.Amount.Sub(supply.OutgoingSupply.Amount), @@ -163,13 +163,13 @@ func (k Keeper) IncrementOutgoingAssetSupply(ctx sdk.Context, coin sdk.Coin) err func (k Keeper) DecrementOutgoingAssetSupply(ctx sdk.Context, coin sdk.Coin) error { supply, found := k.GetAssetSupply(ctx, coin.Denom) if !found { - return sdkerrors.Wrap(types.ErrAssetNotSupported, coin.Denom) + return errorsmod.Wrap(types.ErrAssetNotSupported, coin.Denom) } // Resulting outgoing supply must be greater than or equal to 0 // Use sdk.Int instead of sdk.Coin to prevent panic if true if supply.OutgoingSupply.Amount.Sub(coin.Amount).IsNegative() { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidOutgoingSupply, "decrease %s, outgoing supply %s", coin, diff --git a/modules/htlc/keeper/htlc.go b/modules/htlc/keeper/htlc.go index 99a29969..dad597b2 100644 --- a/modules/htlc/keeper/htlc.go +++ b/modules/htlc/keeper/htlc.go @@ -8,8 +8,8 @@ import ( tmbytes "github.com/cometbft/cometbft/libs/bytes" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/htlc/types" ) @@ -34,7 +34,7 @@ func (k Keeper) CreateHTLC( // check if the HTLC already exists if k.HasHTLC(ctx, id) { - return id, sdkerrors.Wrap(types.ErrHTLCExists, id.String()) + return id, errorsmod.Wrap(types.ErrHTLCExists, id.String()) } expirationHeight := uint64(ctx.BlockHeight()) + timeLock @@ -97,7 +97,7 @@ func (k Keeper) createHTLT( var direction types.SwapDirection if len(amount) != 1 { - return direction, sdkerrors.Wrapf( + return direction, errorsmod.Wrapf( types.ErrInvalidAmount, "amount %s must contain exactly one coin", amount.String(), @@ -115,7 +115,7 @@ func (k Keeper) createHTLT( // Swap amount must be within the specified swap amount limits if amount[0].Amount.LT(asset.MinSwapAmount) || amount[0].Amount.GT(asset.MaxSwapAmount) { - return direction, sdkerrors.Wrapf( + return direction, errorsmod.Wrapf( types.ErrInvalidAmount, "amount %s outside range [%s, %s]", amount[0].Amount, @@ -128,7 +128,7 @@ func (k Keeper) createHTLT( pastTimestampLimit := ctx.BlockTime().Add(-15 * time.Minute).Unix() futureTimestampLimit := ctx.BlockTime().Add(30 * time.Minute).Unix() if timestamp < uint64(pastTimestampLimit) || timestamp >= uint64(futureTimestampLimit) { - return direction, sdkerrors.Wrap( + return direction, errorsmod.Wrap( types.ErrInvalidTimestamp, fmt.Sprintf( "timestamp can neither be 15 minutes ahead of the current time, nor 30 minutes later. block time: %s, timestamp: %s", @@ -142,7 +142,7 @@ func (k Keeper) createHTLT( if sender.Equals(deputyAddress) { if to.Equals(deputyAddress) { - return direction, sdkerrors.Wrapf( + return direction, errorsmod.Wrapf( types.ErrInvalidAccount, "deputy cannot be both sender and receiver: %s", asset.DeputyAddress, @@ -151,7 +151,7 @@ func (k Keeper) createHTLT( direction = types.Incoming } else { if !to.Equals(deputyAddress) { - return direction, sdkerrors.Wrapf(types.ErrInvalidAccount, "deputy must be recipient for outgoing account: %s", to) + return direction, errorsmod.Wrapf(types.ErrInvalidAccount, "deputy must be recipient for outgoing account: %s", to) } direction = types.Outgoing } @@ -172,7 +172,7 @@ func (k Keeper) createHTLT( case types.Outgoing: // Outgoing swaps must have a time lock within the accepted range if timeLock < asset.MinBlockLock || timeLock > asset.MaxBlockLock { - return direction, sdkerrors.Wrapf( + return direction, errorsmod.Wrapf( types.ErrInvalidTimeLock, "time lock %d outside range [%d, %d]", timeLock, @@ -182,7 +182,7 @@ func (k Keeper) createHTLT( } // Amount in outgoing swaps must be able to pay the deputy's fixed fee. if amount[0].Amount.LT(asset.FixedFee.Add(asset.MinSwapAmount)) { - return direction, sdkerrors.Wrapf( + return direction, errorsmod.Wrapf( types.ErrInsufficientAmount, "amount %s is less than fixed fee %s add min swap amount %s", amount[0].String(), asset.FixedFee.String(), asset.MinSwapAmount.String(), @@ -196,7 +196,7 @@ func (k Keeper) createHTLT( return direction, err } default: - return direction, sdkerrors.Wrapf(types.ErrInvalidDirection, direction.String()) + return direction, errorsmod.Wrapf(types.ErrInvalidDirection, direction.String()) } return direction, nil @@ -216,19 +216,19 @@ func (k Keeper) ClaimHTLC( // query the HTLC htlc, found := k.GetHTLC(ctx, id) if !found { - return "", false, types.None, sdkerrors.Wrap(types.ErrUnknownHTLC, id.String()) + return "", false, types.None, errorsmod.Wrap(types.ErrUnknownHTLC, id.String()) } // check if the HTLC is open if htlc.State != types.Open { - return "", false, types.None, sdkerrors.Wrap(types.ErrHTLCNotOpen, id.String()) + return "", false, types.None, errorsmod.Wrap(types.ErrHTLCNotOpen, id.String()) } hashLock, _ := hex.DecodeString(htlc.HashLock) // check if the secret matches with the hash lock if !bytes.Equal(types.GetHashLock(secret, htlc.Timestamp), hashLock) { - return "", false, types.None, sdkerrors.Wrap(types.ErrInvalidSecret, secret.String()) + return "", false, types.None, errorsmod.Wrap(types.ErrInvalidSecret, secret.String()) } to, err := sdk.AccAddressFromBech32(htlc.To) @@ -292,7 +292,7 @@ func (k Keeper) claimHTLT(ctx sdk.Context, htlc types.HTLC) error { return err } default: - return sdkerrors.Wrapf(types.ErrInvalidDirection, htlc.Direction.String()) + return errorsmod.Wrapf(types.ErrInvalidDirection, htlc.Direction.String()) } return nil diff --git a/modules/htlc/keeper/msg_server.go b/modules/htlc/keeper/msg_server.go index c6d246d3..5a6b0063 100644 --- a/modules/htlc/keeper/msg_server.go +++ b/modules/htlc/keeper/msg_server.go @@ -5,6 +5,7 @@ import ( "encoding/hex" "strconv" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -44,7 +45,7 @@ func (m msgServer) CreateHTLC( } if m.k.blockedAddrs[msg.To] { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is a module account", msg.To) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is a module account", msg.To) } ctx := sdk.UnwrapSDKContext(goCtx) @@ -119,7 +120,7 @@ func (m msgServer) UpdateParams( msg *types.MsgUpdateParams, ) (*types.MsgUpdateParamsResponse, error) { if m.k.authority != msg.Authority { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrUnauthorized, "invalid authority; expected %s, got %s", m.k.authority, diff --git a/modules/htlc/keeper/params.go b/modules/htlc/keeper/params.go index 5e686147..42dde266 100644 --- a/modules/htlc/keeper/params.go +++ b/modules/htlc/keeper/params.go @@ -1,8 +1,8 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/htlc/types" ) @@ -52,7 +52,7 @@ func (k Keeper) GetAsset(ctx sdk.Context, denom string) (types.AssetParam, error return asset, nil } } - return types.AssetParam{}, sdkerrors.Wrap(types.ErrAssetNotSupported, denom) + return types.AssetParam{}, errorsmod.Wrap(types.ErrAssetNotSupported, denom) } // SetAsset sets an asset in the params @@ -138,7 +138,7 @@ func (k Keeper) ValidateLiveAsset(ctx sdk.Context, coin sdk.Coin) error { return err } if !asset.Active { - return sdkerrors.Wrap(types.ErrAssetNotActive, asset.Denom) + return errorsmod.Wrap(types.ErrAssetNotActive, asset.Denom) } return nil } diff --git a/modules/htlc/types/errors.go b/modules/htlc/types/errors.go index d496df59..af075381 100644 --- a/modules/htlc/types/errors.go +++ b/modules/htlc/types/errors.go @@ -1,33 +1,33 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // HTLC module sentinel errors var ( - ErrInvalidID = sdkerrors.Register(ModuleName, 2, "invalid htlc id") - ErrInvalidHashLock = sdkerrors.Register(ModuleName, 3, "invalid hash lock") - ErrInvalidTimeLock = sdkerrors.Register(ModuleName, 4, "invalid time lock") - ErrInvalidSecret = sdkerrors.Register(ModuleName, 5, "invalid secret") - ErrInvalidExpirationHeight = sdkerrors.Register(ModuleName, 6, "invalid expiration height") - ErrInvalidTimestamp = sdkerrors.Register(ModuleName, 7, "invalid timestamp") - ErrInvalidState = sdkerrors.Register(ModuleName, 8, "invalid state") - ErrInvalidClosedBlock = sdkerrors.Register(ModuleName, 9, "invalid closed block") - ErrInvalidDirection = sdkerrors.Register(ModuleName, 10, "invalid direction") - ErrHTLCExists = sdkerrors.Register(ModuleName, 11, "htlc already exists") - ErrUnknownHTLC = sdkerrors.Register(ModuleName, 12, "unknown htlc") - ErrHTLCNotOpen = sdkerrors.Register(ModuleName, 13, "htlc not open") - ErrAssetNotSupported = sdkerrors.Register(ModuleName, 14, "asset not found") - ErrAssetNotActive = sdkerrors.Register(ModuleName, 15, "asset is currently inactive") - ErrInvalidAccount = sdkerrors.Register(ModuleName, 16, "invalid account") - ErrInvalidAmount = sdkerrors.Register(ModuleName, 17, "invalid amount") - ErrInsufficientAmount = sdkerrors.Register(ModuleName, 18, "amount cannot cover the deputy fixed fee") - ErrExceedsSupplyLimit = sdkerrors.Register(ModuleName, 19, "asset supply over limit") - ErrExceedsTimeBasedSupplyLimit = sdkerrors.Register(ModuleName, 20, "asset supply over limit for current time period") - ErrInvalidCurrentSupply = sdkerrors.Register(ModuleName, 21, "supply decrease puts current asset supply below 0") - ErrInvalidIncomingSupply = sdkerrors.Register(ModuleName, 22, "supply decrease puts incoming asset supply below 0") - ErrInvalidOutgoingSupply = sdkerrors.Register(ModuleName, 23, "supply decrease puts outgoing asset supply below 0") - ErrExceedsAvailableSupply = sdkerrors.Register(ModuleName, 24, "outgoing swap exceeds total available supply") - ErrAssetSupplyNotFound = sdkerrors.Register(ModuleName, 25, "asset supply not found in store") + ErrInvalidID = errorsmod.Register(ModuleName, 2, "invalid htlc id") + ErrInvalidHashLock = errorsmod.Register(ModuleName, 3, "invalid hash lock") + ErrInvalidTimeLock = errorsmod.Register(ModuleName, 4, "invalid time lock") + ErrInvalidSecret = errorsmod.Register(ModuleName, 5, "invalid secret") + ErrInvalidExpirationHeight = errorsmod.Register(ModuleName, 6, "invalid expiration height") + ErrInvalidTimestamp = errorsmod.Register(ModuleName, 7, "invalid timestamp") + ErrInvalidState = errorsmod.Register(ModuleName, 8, "invalid state") + ErrInvalidClosedBlock = errorsmod.Register(ModuleName, 9, "invalid closed block") + ErrInvalidDirection = errorsmod.Register(ModuleName, 10, "invalid direction") + ErrHTLCExists = errorsmod.Register(ModuleName, 11, "htlc already exists") + ErrUnknownHTLC = errorsmod.Register(ModuleName, 12, "unknown htlc") + ErrHTLCNotOpen = errorsmod.Register(ModuleName, 13, "htlc not open") + ErrAssetNotSupported = errorsmod.Register(ModuleName, 14, "asset not found") + ErrAssetNotActive = errorsmod.Register(ModuleName, 15, "asset is currently inactive") + ErrInvalidAccount = errorsmod.Register(ModuleName, 16, "invalid account") + ErrInvalidAmount = errorsmod.Register(ModuleName, 17, "invalid amount") + ErrInsufficientAmount = errorsmod.Register(ModuleName, 18, "amount cannot cover the deputy fixed fee") + ErrExceedsSupplyLimit = errorsmod.Register(ModuleName, 19, "asset supply over limit") + ErrExceedsTimeBasedSupplyLimit = errorsmod.Register(ModuleName, 20, "asset supply over limit for current time period") + ErrInvalidCurrentSupply = errorsmod.Register(ModuleName, 21, "supply decrease puts current asset supply below 0") + ErrInvalidIncomingSupply = errorsmod.Register(ModuleName, 22, "supply decrease puts incoming asset supply below 0") + ErrInvalidOutgoingSupply = errorsmod.Register(ModuleName, 23, "supply decrease puts outgoing asset supply below 0") + ErrExceedsAvailableSupply = errorsmod.Register(ModuleName, 24, "outgoing swap exceeds total available supply") + ErrAssetSupplyNotFound = errorsmod.Register(ModuleName, 25, "asset supply not found in store") ) diff --git a/modules/htlc/types/genesis.go b/modules/htlc/types/genesis.go index e659309f..23a462a5 100644 --- a/modules/htlc/types/genesis.go +++ b/modules/htlc/types/genesis.go @@ -4,7 +4,7 @@ import ( fmt "fmt" time "time" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // NewGenesisState constructs a new GenesisState instance @@ -40,7 +40,7 @@ func ValidateGenesis(data GenesisState) error { } if htlc.State != Open { - return sdkerrors.Wrap(ErrHTLCNotOpen, htlc.Id) + return errorsmod.Wrap(ErrHTLCNotOpen, htlc.Id) } if err := htlc.Validate(); err != nil { diff --git a/modules/htlc/types/htlc.go b/modules/htlc/types/htlc.go index 2c3aca64..ac5129fd 100644 --- a/modules/htlc/types/htlc.go +++ b/modules/htlc/types/htlc.go @@ -7,6 +7,7 @@ import ( "github.com/cometbft/cometbft/crypto/tmhash" tmbytes "github.com/cometbft/cometbft/libs/bytes" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -55,10 +56,10 @@ func (h HTLC) Validate() error { return err } if _, err := sdk.AccAddressFromBech32(h.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } if _, err := sdk.AccAddressFromBech32(h.To); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) } if err := ValidateReceiverOnOtherChain(h.ReceiverOnOtherChain); err != nil { return err @@ -67,34 +68,34 @@ func (h HTLC) Validate() error { return err } if h.ExpirationHeight == 0 { - return sdkerrors.Wrapf(ErrInvalidExpirationHeight, "expire height cannot be 0") + return errorsmod.Wrapf(ErrInvalidExpirationHeight, "expire height cannot be 0") } if h.Timestamp == 0 { - return sdkerrors.Wrapf(ErrInvalidTimestamp, "timestamp cannot be 0") + return errorsmod.Wrapf(ErrInvalidTimestamp, "timestamp cannot be 0") } if err := ValidateAmount(h.Transfer, h.Amount); err != nil { return err } if h.State > Refunded { - return sdkerrors.Wrapf(ErrInvalidState, "invalid htlc status") + return errorsmod.Wrapf(ErrInvalidState, "invalid htlc status") } if h.State == Completed && h.ClosedBlock == 0 { - return sdkerrors.Wrapf(ErrInvalidClosedBlock, "closed block cannot be 0") + return errorsmod.Wrapf(ErrInvalidClosedBlock, "closed block cannot be 0") } if !h.Transfer && h.Direction != 0 { - return sdkerrors.Wrapf(ErrInvalidDirection, "invalid htlc direction") + return errorsmod.Wrapf(ErrInvalidDirection, "invalid htlc direction") } if h.Transfer && (h.Direction < Incoming || h.Direction > Outgoing) { - return sdkerrors.Wrapf(ErrInvalidDirection, "invalid htlt direction") + return errorsmod.Wrapf(ErrInvalidDirection, "invalid htlt direction") } if h.State != Completed && len(h.Secret) > 0 { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( ErrInvalidSecret, "secret must be empty when the HTLC has not be claimed", ) } if h.State == Completed && len(h.Secret) != SecretLength { - return sdkerrors.Wrapf(ErrInvalidSecret, "length of the secret must be %d", SecretLength) + return errorsmod.Wrapf(ErrInvalidSecret, "length of the secret must be %d", SecretLength) } return nil } @@ -124,16 +125,16 @@ func DefaultAssetSupplies() []AssetSupply { // Validate performs a basic validation of an asset supply fields. func (a AssetSupply) Validate() error { if !a.IncomingSupply.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "incoming supply %s", a.IncomingSupply) + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "incoming supply %s", a.IncomingSupply) } if !a.OutgoingSupply.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "outgoing supply %s", a.OutgoingSupply) + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "outgoing supply %s", a.OutgoingSupply) } if !a.CurrentSupply.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "current supply %s", a.CurrentSupply) + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "current supply %s", a.CurrentSupply) } if !a.TimeLimitedCurrentSupply.IsValid() { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( sdkerrors.ErrInvalidCoins, "time-limited current supply %s", a.CurrentSupply, diff --git a/modules/htlc/types/msgs.go b/modules/htlc/types/msgs.go index 85706195..aa60ccb9 100644 --- a/modules/htlc/types/msgs.go +++ b/modules/htlc/types/msgs.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -56,11 +57,11 @@ func (msg MsgCreateHTLC) Type() string { return TypeMsgCreateHTLC } // ValidateBasic implements Msg func (msg MsgCreateHTLC) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } if _, err := sdk.AccAddressFromBech32(msg.To); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) } if err := ValidateReceiverOnOtherChain(msg.ReceiverOnOtherChain); err != nil { @@ -121,7 +122,7 @@ func (msg MsgClaimHTLC) Type() string { return TypeMsgClaimHTLC } // ValidateBasic implements Msg. func (msg MsgClaimHTLC) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } if err := ValidateID(msg.Id); err != nil { @@ -159,7 +160,7 @@ func (m *MsgUpdateParams) GetSignBytes() []byte { // ValidateBasic executes sanity validation on the provided data func (m *MsgUpdateParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return sdkerrors.Wrap(err, "invalid authority address") + return errorsmod.Wrap(err, "invalid authority address") } return m.Params.Validate() } diff --git a/modules/htlc/types/validation.go b/modules/htlc/types/validation.go index 05cd9795..96606d8a 100644 --- a/modules/htlc/types/validation.go +++ b/modules/htlc/types/validation.go @@ -3,6 +3,7 @@ package types import ( "encoding/hex" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -27,7 +28,7 @@ const ( // ValidateReceiverOnOtherChain verifies if the receiver on the other chain is legal func ValidateReceiverOnOtherChain(receiverOnOtherChain string) error { if len(receiverOnOtherChain) > MaxLengthForAddressOnOtherChain { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "length of the receiver on other chain must be between [0,%d]", MaxLengthForAddressOnOtherChain) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "length of the receiver on other chain must be between [0,%d]", MaxLengthForAddressOnOtherChain) } return nil } @@ -35,7 +36,7 @@ func ValidateReceiverOnOtherChain(receiverOnOtherChain string) error { // ValidateSenderOnOtherChain verifies if the receiver on the other chain is legal func ValidateSenderOnOtherChain(senderOnOtherChain string) error { if len(senderOnOtherChain) > MaxLengthForAddressOnOtherChain { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "length of the sender on other chain must be between [0,%d]", MaxLengthForAddressOnOtherChain) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "length of the sender on other chain must be between [0,%d]", MaxLengthForAddressOnOtherChain) } return nil } @@ -43,10 +44,10 @@ func ValidateSenderOnOtherChain(senderOnOtherChain string) error { // ValidateAmount verifies whether the given amount is legal func ValidateAmount(transfer bool, amount sdk.Coins) error { if transfer && len(amount) != 1 { - return sdkerrors.Wrapf(ErrInvalidAmount, "amount %s must contain exactly one coin", amount.String()) + return errorsmod.Wrapf(ErrInvalidAmount, "amount %s must contain exactly one coin", amount.String()) } if !(amount.IsValid() && amount.IsAllPositive()) { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "the transferred amount must be valid") + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, "the transferred amount must be valid") } return nil } @@ -54,10 +55,10 @@ func ValidateAmount(transfer bool, amount sdk.Coins) error { // ValidateID verifies whether the given ID lock is legal func ValidateID(id string) error { if len(id) != HTLCIDLength { - return sdkerrors.Wrapf(ErrInvalidID, "length of the htlc id must be %d", HTLCIDLength) + return errorsmod.Wrapf(ErrInvalidID, "length of the htlc id must be %d", HTLCIDLength) } if _, err := hex.DecodeString(id); err != nil { - return sdkerrors.Wrapf(ErrInvalidID, "id must be a hex encoded string") + return errorsmod.Wrapf(ErrInvalidID, "id must be a hex encoded string") } return nil } @@ -65,10 +66,10 @@ func ValidateID(id string) error { // ValidateHashLock verifies whether the given hash lock is legal func ValidateHashLock(hashLock string) error { if len(hashLock) != HashLockLength { - return sdkerrors.Wrapf(ErrInvalidHashLock, "length of the hash lock must be %d", HashLockLength) + return errorsmod.Wrapf(ErrInvalidHashLock, "length of the hash lock must be %d", HashLockLength) } if _, err := hex.DecodeString(hashLock); err != nil { - return sdkerrors.Wrapf(ErrInvalidHashLock, "hash lock must be a hex encoded string") + return errorsmod.Wrapf(ErrInvalidHashLock, "hash lock must be a hex encoded string") } return nil } @@ -76,7 +77,7 @@ func ValidateHashLock(hashLock string) error { // ValidateTimeLock verifies whether the given time lock is legal func ValidateTimeLock(timeLock uint64) error { if timeLock < MinTimeLock || timeLock > MaxTimeLock { - return sdkerrors.Wrapf(ErrInvalidTimeLock, "the time lock must be between [%d,%d]", MinTimeLock, MaxTimeLock) + return errorsmod.Wrapf(ErrInvalidTimeLock, "the time lock must be between [%d,%d]", MinTimeLock, MaxTimeLock) } return nil } @@ -84,10 +85,10 @@ func ValidateTimeLock(timeLock uint64) error { // ValidateSecret verifies whether the given secret is legal func ValidateSecret(secret string) error { if len(secret) != SecretLength { - return sdkerrors.Wrapf(ErrInvalidSecret, "length of the secret must be %d", SecretLength) + return errorsmod.Wrapf(ErrInvalidSecret, "length of the secret must be %d", SecretLength) } if _, err := hex.DecodeString(secret); err != nil { - return sdkerrors.Wrapf(ErrInvalidSecret, "secret must be a hex encoded string") + return errorsmod.Wrapf(ErrInvalidSecret, "secret must be a hex encoded string") } return nil } diff --git a/modules/mt/client/cli/query.go b/modules/mt/client/cli/query.go index f6097ea4..ae4c2a70 100644 --- a/modules/mt/client/cli/query.go +++ b/modules/mt/client/cli/query.go @@ -3,6 +3,7 @@ package cli import ( "context" "fmt" + "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" diff --git a/modules/mt/client/testutil/grpc_query_test.go b/modules/mt/client/testutil/grpc_query_test.go index 9ebb3ddd..35bcf3f2 100644 --- a/modules/mt/client/testutil/grpc_query_test.go +++ b/modules/mt/client/testutil/grpc_query_test.go @@ -8,12 +8,14 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/gogoproto/proto" + mtcli "github.com/irisnet/irismod/modules/mt/client/cli" mttestutil "github.com/irisnet/irismod/modules/mt/client/testutil" mttypes "github.com/irisnet/irismod/modules/mt/types" - "github.com/irisnet/irismod/simapp" "github.com/stretchr/testify/suite" + + "github.com/irisnet/irismod/simapp" ) type IntegrationTestSuite struct { diff --git a/modules/mt/genesis.go b/modules/mt/genesis.go index d23d083f..c452b658 100644 --- a/modules/mt/genesis.go +++ b/modules/mt/genesis.go @@ -1,8 +1,10 @@ package mt import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/irisnet/irismod/modules/mt/keeper" "github.com/irisnet/irismod/modules/mt/types" ) @@ -40,7 +42,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) { for _, o := range data.Owners { addr, err := sdk.AccAddressFromBech32(o.Address) if err != nil { - panic(sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", addr)) + panic(errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", addr)) } for _, d := range o.Denoms { diff --git a/modules/mt/handler.go b/modules/mt/handler.go index 8004b309..1c9e78e4 100644 --- a/modules/mt/handler.go +++ b/modules/mt/handler.go @@ -1,6 +1,7 @@ package mt import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -41,7 +42,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized mt message type: %T", msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized mt message type: %T", msg) } } } diff --git a/modules/mt/keeper/balance.go b/modules/mt/keeper/balance.go index 237c1916..ec560dc7 100644 --- a/modules/mt/keeper/balance.go +++ b/modules/mt/keeper/balance.go @@ -4,8 +4,10 @@ import ( "bytes" "math" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/irisnet/irismod/modules/mt/types" ) @@ -17,7 +19,7 @@ func (k Keeper) AddBalance(ctx sdk.Context, balance := k.GetBalance(ctx, denomID, mtID, addr) if math.MaxUint64-balance < amount { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "overflow: max %d, got %d", math.MaxUint64-balance, amount) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "overflow: max %d, got %d", math.MaxUint64-balance, amount) } balance += amount @@ -151,7 +153,7 @@ func (k Keeper) IncreaseDenomSupply(ctx sdk.Context, denomID string) { func (k Keeper) IncreaseMTSupply(ctx sdk.Context, denomID, mtID string, amount uint64) error { supply := k.GetMTSupply(ctx, denomID, mtID) if math.MaxUint64-supply < amount { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "overflow: max %d, got %d", math.MaxUint64-supply, amount) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "overflow: max %d, got %d", math.MaxUint64-supply, amount) } supply += amount diff --git a/modules/mt/keeper/denom.go b/modules/mt/keeper/denom.go index 93302af3..2b4711a0 100644 --- a/modules/mt/keeper/denom.go +++ b/modules/mt/keeper/denom.go @@ -3,6 +3,8 @@ package keeper import ( "crypto/sha256" "fmt" + + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -63,7 +65,7 @@ func (k Keeper) GetDenoms(ctx sdk.Context) (denoms []types.Denom) { // UpdateDenom is responsible for updating the definition of denom func (k Keeper) UpdateDenom(ctx sdk.Context, denom types.Denom) error { if !k.HasDenom(ctx, denom.Id) { - return sdkerrors.Wrapf(sdkerrors.ErrNotFound, "denom not found (%s)", denom.Id) + return errorsmod.Wrapf(sdkerrors.ErrNotFound, "denom not found (%s)", denom.Id) } store := ctx.KVStore(k.storeKey) diff --git a/modules/mt/keeper/grpc_query.go b/modules/mt/keeper/grpc_query.go index 589a74d9..50a3aefc 100644 --- a/modules/mt/keeper/grpc_query.go +++ b/modules/mt/keeper/grpc_query.go @@ -2,13 +2,15 @@ package keeper import ( "context" + "strings" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/irisnet/irismod/modules/mt/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "strings" + + "github.com/irisnet/irismod/modules/mt/types" ) var _ types.QueryServer = Keeper{} diff --git a/modules/mt/keeper/keeper.go b/modules/mt/keeper/keeper.go index 8255b8cb..5d24b1bb 100644 --- a/modules/mt/keeper/keeper.go +++ b/modules/mt/keeper/keeper.go @@ -5,6 +5,7 @@ import ( "github.com/cometbft/cometbft/libs/log" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -121,7 +122,7 @@ func (k Keeper) TransferOwner(ctx sdk.Context, srcOwnerAmount := k.GetBalance(ctx, denomID, mtID, srcOwner) if srcOwnerAmount < amount { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( sdkerrors.ErrInsufficientFunds, "insufficient balance: %d", srcOwnerAmount, @@ -139,7 +140,7 @@ func (k Keeper) BurnMT(ctx sdk.Context, srcOwnerAmount := k.GetBalance(ctx, denomID, mtID, owner) if srcOwnerAmount < amount { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( sdkerrors.ErrInsufficientFunds, "insufficient balance: %d", srcOwnerAmount, diff --git a/modules/mt/keeper/msg_server.go b/modules/mt/keeper/msg_server.go index 4c2bd8a1..d0964bbb 100644 --- a/modules/mt/keeper/msg_server.go +++ b/modules/mt/keeper/msg_server.go @@ -5,8 +5,10 @@ import ( "strconv" "strings" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/irisnet/irismod/modules/mt/types" ) @@ -81,7 +83,7 @@ func (m msgServer) MintMT( // if user inputs an MT ID, then mint amounts to the MT, else issue a new MT if len(mtID) > 0 { if !m.Keeper.HasMT(ctx, msg.DenomId, mtID) { - return nil, sdkerrors.Wrapf(sdkerrors.ErrNotFound, "mt not found (%s)", mtID) + return nil, errorsmod.Wrapf(sdkerrors.ErrNotFound, "mt not found (%s)", mtID) } if err := m.Keeper.MintMT(ctx, msg.DenomId, mtID, msg.Amount, recipient); err != nil { diff --git a/modules/mt/keeper/mt.go b/modules/mt/keeper/mt.go index 30076e51..fc4efd60 100644 --- a/modules/mt/keeper/mt.go +++ b/modules/mt/keeper/mt.go @@ -3,6 +3,8 @@ package keeper import ( "crypto/sha256" "fmt" + + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -27,7 +29,7 @@ func (k Keeper) GetMT(ctx sdk.Context, denomID, mtID string) (mt exported.MT, er bz := store.Get(types.KeyMT(denomID, mtID)) if bz == nil { - return nil, sdkerrors.Wrapf(sdkerrors.ErrNotFound, "mt not found (%s)", mtID) + return nil, errorsmod.Wrapf(sdkerrors.ErrNotFound, "mt not found (%s)", mtID) } var baseMT types.MT @@ -61,11 +63,11 @@ func (k Keeper) GetMTs(ctx sdk.Context, denomID string) (mts []exported.MT) { func (k Keeper) Authorize(ctx sdk.Context, denomID string, owner sdk.AccAddress) error { denom, found := k.GetDenom(ctx, denomID) if !found { - return sdkerrors.Wrapf(sdkerrors.ErrNotFound, "denom not found (%s)", denomID) + return errorsmod.Wrapf(sdkerrors.ErrNotFound, "denom not found (%s)", denomID) } if owner.String() != denom.Owner { - return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, owner.String()) + return errorsmod.Wrap(sdkerrors.ErrUnauthorized, owner.String()) } return nil diff --git a/modules/mt/simulation/genesis.go b/modules/mt/simulation/genesis.go index c6e1523c..e00be94a 100644 --- a/modules/mt/simulation/genesis.go +++ b/modules/mt/simulation/genesis.go @@ -3,10 +3,12 @@ package simulation import ( "encoding/json" "fmt" + "math/rand" + "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + mt "github.com/irisnet/irismod/modules/mt/types" - "math/rand" ) const ( diff --git a/modules/mt/simulation/operations.go b/modules/mt/simulation/operations.go index f31f7a5c..5170db71 100644 --- a/modules/mt/simulation/operations.go +++ b/modules/mt/simulation/operations.go @@ -10,6 +10,7 @@ import ( moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/irisnet/irismod/modules/mt/keeper" mt "github.com/irisnet/irismod/modules/mt/types" ) diff --git a/modules/mt/types/genesis.go b/modules/mt/types/genesis.go index e00edb07..4cd5a86e 100644 --- a/modules/mt/types/genesis.go +++ b/modules/mt/types/genesis.go @@ -1,7 +1,8 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" + "github.com/irisnet/irismod/modules/mt/exported" ) @@ -45,7 +46,7 @@ func ValidateGenesis(data GenesisState) error { denomMap2[d.DenomId] = true if _, ok := denomMap1[d.DenomId]; !ok { - return sdkerrors.Wrapf(sdkerrors.ErrPanic, "unknown mt denom, (%s)", d.DenomId) + return errorsmod.Wrapf(errorsmod.ErrPanic, "unknown mt denom, (%s)", d.DenomId) } for _, b := range d.Balances { mtMap2[d.DenomId+b.MtId] = mtMap2[d.DenomId+b.MtId] + b.Amount @@ -57,13 +58,13 @@ func ValidateGenesis(data GenesisState) error { mtCount2 := len(mtMap2) if mtCount1 != mtCount2 { - return sdkerrors.Wrapf(sdkerrors.ErrPanic, "mt count mismatch, (%d, %d)", mtCount1, mtCount2) + return errorsmod.Wrapf(errorsmod.ErrPanic, "mt count mismatch, (%d, %d)", mtCount1, mtCount2) } for id1, supply1 := range mtMap1 { supply2 := mtMap2[id1] if supply1 != supply2 { - return sdkerrors.Wrapf(sdkerrors.ErrPanic, "mt supply mismatch, id: %s (%d, %d)", id1, supply1, mtCount2) + return errorsmod.Wrapf(errorsmod.ErrPanic, "mt supply mismatch, id: %s (%d, %d)", id1, supply1, mtCount2) } } diff --git a/modules/mt/types/msgs.go b/modules/mt/types/msgs.go index ee59bec3..2ff8d7ab 100644 --- a/modules/mt/types/msgs.go +++ b/modules/mt/types/msgs.go @@ -1,9 +1,11 @@ package types import ( + "strings" + + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "strings" ) // constant used to indicate that some field should not be updated @@ -46,11 +48,11 @@ func (msg MsgIssueDenom) Type() string { return TypeMsgIssueDenom } func (msg MsgIssueDenom) ValidateBasic() error { if len(strings.TrimSpace(msg.Name)) <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "name is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "name is required") } if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } return nil } @@ -92,23 +94,23 @@ func (msg MsgTransferMT) Type() string { return TypeMsgTransferMT } // ValidateBasic Implements Msg. func (msg MsgTransferMT) ValidateBasic() error { if len(strings.TrimSpace(msg.Id)) <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "mt id is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "mt id is required") } if len(strings.TrimSpace(msg.DenomId)) <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "denom id is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "denom id is required") } if msg.Amount <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "amount is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "amount is required") } if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } if _, err := sdk.AccAddressFromBech32(msg.Recipient); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) } return nil } @@ -149,15 +151,15 @@ func (msg MsgEditMT) Type() string { return TypeMsgEditMT } // ValidateBasic Implements Msg. func (msg MsgEditMT) ValidateBasic() error { if len(strings.TrimSpace(msg.Id)) <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "mt id is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "mt id is required") } if len(strings.TrimSpace(msg.DenomId)) <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "denom id is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "denom id is required") } if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } return nil @@ -202,24 +204,24 @@ func (msg MsgMintMT) Type() string { return TypeMsgMintMT } func (msg MsgMintMT) ValidateBasic() error { if len(strings.TrimSpace(msg.DenomId)) <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "denom id is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "denom id is required") } if msg.Amount <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "amount is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "amount is required") } if len(strings.TrimSpace(msg.Id)) > 0 && len(msg.Data) > 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "metadata can not be accepted while minting, use 'edit mt' instead") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "metadata can not be accepted while minting, use 'edit mt' instead") } if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } if len(strings.TrimSpace(msg.Recipient)) > 0 { if _, err := sdk.AccAddressFromBech32(msg.Recipient); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid receipt address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid receipt address (%s)", err) } } @@ -260,19 +262,19 @@ func (msg MsgBurnMT) Type() string { return TypeMsgBurnMT } // ValidateBasic Implements Msg. func (msg MsgBurnMT) ValidateBasic() error { if len(strings.TrimSpace(msg.Id)) <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "mt id is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "mt id is required") } if len(strings.TrimSpace(msg.DenomId)) <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "denom id is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "denom id is required") } if msg.Amount <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "amount is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "amount is required") } if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } return nil @@ -311,15 +313,15 @@ func (msg MsgTransferDenom) Type() string { return TypeMsgTransferDenom } // ValidateBasic Implements Msg. func (msg MsgTransferDenom) ValidateBasic() error { if len(strings.TrimSpace(msg.Id)) <= 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "denom id is required") + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "denom id is required") } if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } if _, err := sdk.AccAddressFromBech32(msg.Recipient); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) } return nil diff --git a/modules/nft/keeper/denom.go b/modules/nft/keeper/denom.go index cf9987c0..4f695321 100644 --- a/modules/nft/keeper/denom.go +++ b/modules/nft/keeper/denom.go @@ -1,6 +1,7 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -58,7 +59,7 @@ func (k Keeper) TransferDenomOwner( // authorize if srcOwner.String() != denom.Creator { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to transfer denom %s", srcOwner.String(), denomID) + return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to transfer denom %s", srcOwner.String(), denomID) } denomMetadata := &types.DenomMetadata{ @@ -90,7 +91,7 @@ func (k Keeper) TransferDenomOwner( func (k Keeper) GetDenomInfo(ctx sdk.Context, denomID string) (*types.Denom, error) { class, has := k.nk.GetClass(ctx, denomID) if !has { - return nil, sdkerrors.Wrapf(types.ErrInvalidDenom, "denom ID %s not exists", denomID) + return nil, errorsmod.Wrapf(types.ErrInvalidDenom, "denom ID %s not exists", denomID) } var denomMetadata types.DenomMetadata diff --git a/modules/nft/keeper/grpc_query.go b/modules/nft/keeper/grpc_query.go index 2d42c7e0..ff17e9e6 100644 --- a/modules/nft/keeper/grpc_query.go +++ b/modules/nft/keeper/grpc_query.go @@ -6,8 +6,8 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/nft" "github.com/irisnet/irismod/modules/nft/types" @@ -167,12 +167,12 @@ func (k Keeper) NFT(c context.Context, request *types.QueryNFTRequest) (*types.Q nft, err := k.GetNFT(ctx, request.DenomId, request.TokenId) if err != nil { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "invalid NFT %s from collection %s", request.TokenId, request.DenomId) + return nil, errorsmod.Wrapf(types.ErrUnknownNFT, "invalid NFT %s from collection %s", request.TokenId, request.DenomId) } baseNFT, ok := nft.(types.BaseNFT) if !ok { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "invalid type NFT %s from collection %s", request.TokenId, request.DenomId) + return nil, errorsmod.Wrapf(types.ErrUnknownNFT, "invalid type NFT %s from collection %s", request.TokenId, request.DenomId) } return &types.QueryNFTResponse{NFT: &baseNFT}, nil diff --git a/modules/nft/keeper/invariants.go b/modules/nft/keeper/invariants.go index d63243b6..45cc74d4 100644 --- a/modules/nft/keeper/invariants.go +++ b/modules/nft/keeper/invariants.go @@ -6,6 +6,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/irisnet/irismod/modules/nft/types" ) diff --git a/modules/nft/keeper/msg_server.go b/modules/nft/keeper/msg_server.go index 8756af9b..6b5cd34b 100644 --- a/modules/nft/keeper/msg_server.go +++ b/modules/nft/keeper/msg_server.go @@ -3,6 +3,7 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -71,7 +72,7 @@ func (k Keeper) MintNFT( } if denom.MintRestricted && denom.Creator != sender.String() { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrUnauthorized, "%s is not allowed to mint NFT of denom %s", sender, diff --git a/modules/nft/keeper/nft.go b/modules/nft/keeper/nft.go index bfae6551..c8cd23bc 100644 --- a/modules/nft/keeper/nft.go +++ b/modules/nft/keeper/nft.go @@ -1,6 +1,7 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -52,7 +53,7 @@ func (k Keeper) UpdateNFT(ctx sdk.Context, denomID, if denom.UpdateRestricted { // if true , nobody can update the NFT under this denom - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "nobody can update the NFT under this denom %s", denomID) + return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "nobody can update the NFT under this denom %s", denomID) } // just the owner of NFT can edit @@ -69,7 +70,7 @@ func (k Keeper) UpdateNFT(ctx sdk.Context, denomID, token, exist := k.nk.GetNFT(ctx, denomID, tokenID) if !exist { - return sdkerrors.Wrapf(types.ErrUnknownNFT, "nft ID %s not exists", tokenID) + return errorsmod.Wrapf(types.ErrUnknownNFT, "nft ID %s not exists", tokenID) } token.Uri = types.Modify(token.Uri, tokenURI) @@ -103,7 +104,7 @@ func (k Keeper) TransferOwnership(ctx sdk.Context, denomID, ) error { token, exist := k.nk.GetNFT(ctx, denomID, tokenID) if !exist { - return sdkerrors.Wrapf(types.ErrInvalidTokenID, "nft ID %s not exists", tokenID) + return errorsmod.Wrapf(types.ErrInvalidTokenID, "nft ID %s not exists", tokenID) } if err := k.Authorize(ctx, denomID, tokenID, srcOwner); err != nil { @@ -119,7 +120,7 @@ func (k Keeper) TransferOwnership(ctx sdk.Context, denomID, tokenMetadataChanged := types.Modified(tokenNm) || types.Modified(tokenData) if denom.UpdateRestricted && (tokenChanged || tokenMetadataChanged) { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "It is restricted to update NFT under this denom %s", denom.Id) + return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "It is restricted to update NFT under this denom %s", denom.Id) } if !tokenChanged && !tokenMetadataChanged { @@ -161,7 +162,7 @@ func (k Keeper) RemoveNFT(ctx sdk.Context, denomID, tokenID string, owner sdk.Ac func (k Keeper) GetNFT(ctx sdk.Context, denomID, tokenID string) (nft exported.NFT, err error) { token, exist := k.nk.GetNFT(ctx, denomID, tokenID) if !exist { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "not found NFT: %s", denomID) + return nil, errorsmod.Wrapf(types.ErrUnknownNFT, "not found NFT: %s", denomID) } nftMetadata, err := types.UnmarshalNFTMetadata(k.cdc, token.Data.GetValue()) @@ -204,7 +205,7 @@ func (k Keeper) GetNFTs(ctx sdk.Context, denom string) (nfts []exported.NFT, err // Return the NFT if true, an error otherwise func (k Keeper) Authorize(ctx sdk.Context, denomID, tokenID string, owner sdk.AccAddress) error { if !owner.Equals(k.nk.GetOwner(ctx, denomID, tokenID)) { - return sdkerrors.Wrap(types.ErrUnauthorized, owner.String()) + return errorsmod.Wrap(types.ErrUnauthorized, owner.String()) } return nil } diff --git a/modules/nft/keeper/pagination_test.go b/modules/nft/keeper/pagination_test.go index 5558257c..b1d6d880 100644 --- a/modules/nft/keeper/pagination_test.go +++ b/modules/nft/keeper/pagination_test.go @@ -1,9 +1,10 @@ package keeper import ( + "testing" + "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" - "testing" ) var ShapePageRequest = shapePageRequest diff --git a/modules/nft/types/genesis.go b/modules/nft/types/genesis.go index d24a46c8..24f8c740 100644 --- a/modules/nft/types/genesis.go +++ b/modules/nft/types/genesis.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -26,7 +27,7 @@ func ValidateGenesis(data GenesisState) error { for _, nft := range c.NFTs { if nft.GetOwner().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "missing owner") + return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "missing owner") } if err := ValidateTokenID(nft.GetID()); err != nil { diff --git a/modules/nft/types/msgs.go b/modules/nft/types/msgs.go index 9d038e1d..b7119252 100644 --- a/modules/nft/types/msgs.go +++ b/modules/nft/types/msgs.go @@ -227,7 +227,7 @@ func (msg MsgMintNFT) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Recipient); err != nil { return errormod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid receipt address (%s)", err) } - if IsIBCDenom(msg.DenomId){ + if IsIBCDenom(msg.DenomId) { return errormod.Wrapf(sdkerrors.ErrInvalidRequest, "can not mint nft in denom (%s)", msg.DenomId) } if err := ValidateDenomID(msg.DenomId); err != nil { diff --git a/modules/oracle/handler.go b/modules/oracle/handler.go index f93b43ed..09433353 100644 --- a/modules/oracle/handler.go +++ b/modules/oracle/handler.go @@ -1,6 +1,7 @@ package oracle import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -33,7 +34,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } } } diff --git a/modules/oracle/keeper/ante.go b/modules/oracle/keeper/ante.go index 845b163e..4d6d734f 100644 --- a/modules/oracle/keeper/ante.go +++ b/modules/oracle/keeper/ante.go @@ -1,6 +1,7 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -26,11 +27,11 @@ func (dtf ValidateOracleAuthDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, si case *types.MsgCreateFeed: creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid creator") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "invalid creator") } if !dtf.ak.Authorized(ctx, creator) { - return ctx, sdkerrors.Wrapf(types.ErrUnauthorized, msg.Creator) + return ctx, errorsmod.Wrapf(types.ErrUnauthorized, msg.Creator) } } } diff --git a/modules/oracle/keeper/keeper.go b/modules/oracle/keeper/keeper.go index 340affe2..b3799bdc 100644 --- a/modules/oracle/keeper/keeper.go +++ b/modules/oracle/keeper/keeper.go @@ -10,10 +10,10 @@ import ( tmbytes "github.com/cometbft/cometbft/libs/bytes" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/oracle/types" serviceexported "github.com/irisnet/irismod/modules/service/exported" @@ -55,7 +55,7 @@ func NewKeeper( // CreateFeed creates a stopped feed func (k Keeper) CreateFeed(ctx sdk.Context, msg *types.MsgCreateFeed) error { if _, found := k.GetFeed(ctx, msg.FeedName); found { - return sdkerrors.Wrapf(types.ErrExistedFeedName, msg.FeedName) + return errorsmod.Wrapf(types.ErrExistedFeedName, msg.FeedName) } providers := make([]sdk.AccAddress, len(msg.Providers)) @@ -102,24 +102,24 @@ func (k Keeper) CreateFeed(ctx sdk.Context, msg *types.MsgCreateFeed) error { func (k Keeper) StartFeed(ctx sdk.Context, msg *types.MsgStartFeed) error { feed, found := k.GetFeed(ctx, msg.FeedName) if !found { - return sdkerrors.Wrapf(types.ErrUnknownFeedName, msg.FeedName) + return errorsmod.Wrapf(types.ErrUnknownFeedName, msg.FeedName) } requestContextID, _ := hex.DecodeString(feed.RequestContextID) creator, _ := sdk.AccAddressFromBech32(msg.Creator) if msg.Creator != feed.Creator { - return sdkerrors.Wrapf(types.ErrUnauthorized, msg.Creator) + return errorsmod.Wrapf(types.ErrUnauthorized, msg.Creator) } reqCtx, existed := k.sk.GetRequestContext(ctx, requestContextID) if !existed { - return sdkerrors.Wrapf(types.ErrUnknownFeedName, msg.FeedName) + return errorsmod.Wrapf(types.ErrUnknownFeedName, msg.FeedName) } // Can not start feed in "running" state if reqCtx.State == serviceexported.RUNNING { - return sdkerrors.Wrapf(types.ErrInvalidFeedState, msg.FeedName) + return errorsmod.Wrapf(types.ErrInvalidFeedState, msg.FeedName) } if err := k.sk.StartRequestContext(ctx, requestContextID, creator); err != nil { @@ -134,24 +134,24 @@ func (k Keeper) StartFeed(ctx sdk.Context, msg *types.MsgStartFeed) error { func (k Keeper) PauseFeed(ctx sdk.Context, msg *types.MsgPauseFeed) error { feed, found := k.GetFeed(ctx, msg.FeedName) if !found { - return sdkerrors.Wrapf(types.ErrUnknownFeedName, msg.FeedName) + return errorsmod.Wrapf(types.ErrUnknownFeedName, msg.FeedName) } requestContextID, _ := hex.DecodeString(feed.RequestContextID) creator, _ := sdk.AccAddressFromBech32(msg.Creator) if msg.Creator != feed.Creator { - return sdkerrors.Wrapf(types.ErrUnauthorized, msg.Creator) + return errorsmod.Wrapf(types.ErrUnauthorized, msg.Creator) } reqCtx, existed := k.sk.GetRequestContext(ctx, requestContextID) if !existed { - return sdkerrors.Wrapf(types.ErrUnknownFeedName, msg.FeedName) + return errorsmod.Wrapf(types.ErrUnknownFeedName, msg.FeedName) } // Can only pause feed in "running" state if reqCtx.State != serviceexported.RUNNING { - return sdkerrors.Wrapf(types.ErrInvalidFeedState, msg.FeedName) + return errorsmod.Wrapf(types.ErrInvalidFeedState, msg.FeedName) } if err := k.sk.PauseRequestContext(ctx, requestContextID, creator); err != nil { @@ -166,11 +166,11 @@ func (k Keeper) PauseFeed(ctx sdk.Context, msg *types.MsgPauseFeed) error { func (k Keeper) EditFeed(ctx sdk.Context, msg *types.MsgEditFeed) error { feed, found := k.GetFeed(ctx, msg.FeedName) if !found { - return sdkerrors.Wrapf(types.ErrUnknownFeedName, msg.FeedName) + return errorsmod.Wrapf(types.ErrUnknownFeedName, msg.FeedName) } if msg.Creator != feed.Creator { - return sdkerrors.Wrapf(types.ErrUnauthorized, msg.Creator) + return errorsmod.Wrapf(types.ErrUnauthorized, msg.Creator) } requestContextID, _ := hex.DecodeString(feed.RequestContextID) diff --git a/modules/oracle/keeper/pagination_test.go b/modules/oracle/keeper/pagination_test.go index 5558257c..b1d6d880 100644 --- a/modules/oracle/keeper/pagination_test.go +++ b/modules/oracle/keeper/pagination_test.go @@ -1,9 +1,10 @@ package keeper import ( + "testing" + "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" - "testing" ) var ShapePageRequest = shapePageRequest diff --git a/modules/oracle/types/aggregate.go b/modules/oracle/types/aggregate.go index 2c2374f0..35f01f35 100644 --- a/modules/oracle/types/aggregate.go +++ b/modules/oracle/types/aggregate.go @@ -7,7 +7,7 @@ import ( "github.com/tidwall/gjson" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) var ( @@ -28,7 +28,7 @@ func init() { func GetAggregateFunc(methodNm string) (Aggregate, error) { fun, ok := router[methodNm] if !ok { - return nil, sdkerrors.Wrapf(ErrNotRegisterFunc, methodNm) + return nil, errorsmod.Wrapf(ErrNotRegisterFunc, methodNm) } return fun, nil } diff --git a/modules/oracle/types/errors.go b/modules/oracle/types/errors.go index 8a9b4d82..f7ec2aaf 100644 --- a/modules/oracle/types/errors.go +++ b/modules/oracle/types/errors.go @@ -1,18 +1,18 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // oracle module sentinel errors var ( - ErrUnknownFeedName = sdkerrors.Register(ModuleName, 2, "unknown feed") - ErrInvalidFeedName = sdkerrors.Register(ModuleName, 3, "invalid feed name") - ErrExistedFeedName = sdkerrors.Register(ModuleName, 4, "feed already exists") - ErrUnauthorized = sdkerrors.Register(ModuleName, 5, "unauthorized owner") - ErrInvalidServiceName = sdkerrors.Register(ModuleName, 6, "invalid service name") - ErrInvalidDescription = sdkerrors.Register(ModuleName, 7, "invalid description") - ErrNotRegisterFunc = sdkerrors.Register(ModuleName, 8, "method don't register") - ErrInvalidFeedState = sdkerrors.Register(ModuleName, 9, "invalid state feed") - ErrInvalidServiceFeeCap = sdkerrors.Register(ModuleName, 10, "service fee cap is invalid") + ErrUnknownFeedName = errorsmod.Register(ModuleName, 2, "unknown feed") + ErrInvalidFeedName = errorsmod.Register(ModuleName, 3, "invalid feed name") + ErrExistedFeedName = errorsmod.Register(ModuleName, 4, "feed already exists") + ErrUnauthorized = errorsmod.Register(ModuleName, 5, "unauthorized owner") + ErrInvalidServiceName = errorsmod.Register(ModuleName, 6, "invalid service name") + ErrInvalidDescription = errorsmod.Register(ModuleName, 7, "invalid description") + ErrNotRegisterFunc = errorsmod.Register(ModuleName, 8, "method don't register") + ErrInvalidFeedState = errorsmod.Register(ModuleName, 9, "invalid state feed") + ErrInvalidServiceFeeCap = errorsmod.Register(ModuleName, 10, "service fee cap is invalid") ) diff --git a/modules/oracle/types/msgs.go b/modules/oracle/types/msgs.go index 7b39bb78..f9891ded 100644 --- a/modules/oracle/types/msgs.go +++ b/modules/oracle/types/msgs.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -55,7 +56,7 @@ func (msg MsgCreateFeed) ValidateBasic() error { return err } if len(msg.Providers) == 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "providers missing") + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "providers missing") } if err := ValidateAggregateFunc(msg.AggregateFunc); err != nil { @@ -63,7 +64,7 @@ func (msg MsgCreateFeed) ValidateBasic() error { } if !msg.ServiceFeeCap.IsValid() { - return sdkerrors.Wrapf(ErrInvalidServiceFeeCap, msg.ServiceFeeCap.String()) + return errorsmod.Wrapf(ErrInvalidServiceFeeCap, msg.ServiceFeeCap.String()) } if err := ValidateCreator(msg.Creator); err != nil { diff --git a/modules/oracle/types/validation.go b/modules/oracle/types/validation.go index eb605694..3c87a44c 100644 --- a/modules/oracle/types/validation.go +++ b/modules/oracle/types/validation.go @@ -3,6 +3,7 @@ package types import ( "regexp" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -26,7 +27,7 @@ var ( // ValidateFeedName verifies if the feed name is legal func ValidateFeedName(feedName string) error { if !regexpFeedName.MatchString(feedName) { - return sdkerrors.Wrap(ErrInvalidFeedName, feedName) + return errorsmod.Wrap(ErrInvalidFeedName, feedName) } return nil } @@ -34,7 +35,7 @@ func ValidateFeedName(feedName string) error { // ValidateDescription verifies if the description is legal func ValidateDescription(desc string) error { if len(desc) > MaxDescriptionLen { - return sdkerrors.Wrap(ErrInvalidDescription, desc) + return errorsmod.Wrap(ErrInvalidDescription, desc) } return nil } @@ -42,7 +43,7 @@ func ValidateDescription(desc string) error { // ValidateAggregateFunc verifies if the aggregation function is legal func ValidateAggregateFunc(aggregateFunc string) error { if len(aggregateFunc) == 0 || len(aggregateFunc) > MaxAggregateFuncNameLen { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "aggregate func must between [1, %d], got: %d", MaxAggregateFuncNameLen, len(aggregateFunc)) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "aggregate func must between [1, %d], got: %d", MaxAggregateFuncNameLen, len(aggregateFunc)) } if _, err := GetAggregateFunc(aggregateFunc); err != nil { @@ -54,7 +55,7 @@ func ValidateAggregateFunc(aggregateFunc string) error { // ValidateLatestHistory verifies if the latest history is legal func ValidateLatestHistory(latestHistory uint64) error { if latestHistory < 1 || latestHistory > MaxLatestHistory { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "latest history is invalid, should be between 1 and %d", MaxLatestHistory) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "latest history is invalid, should be between 1 and %d", MaxLatestHistory) } return nil } @@ -62,7 +63,7 @@ func ValidateLatestHistory(latestHistory uint64) error { // ValidateCreator verifies if the creator is legal func ValidateCreator(creator string) error { if _, err := sdk.AccAddressFromBech32(creator); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator") + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator") } return nil } @@ -75,7 +76,7 @@ func ValidateServiceName(serviceName string) error { // ValidateResponseThreshold verifies whether the given threshold is legal func ValidateResponseThreshold(responseThreshold uint32, maxCnt int) error { if (maxCnt != 0 && int(responseThreshold) > maxCnt) || responseThreshold < 1 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "response threshold should be between 1 and %d", maxCnt) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "response threshold should be between 1 and %d", maxCnt) } return nil } @@ -83,7 +84,7 @@ func ValidateResponseThreshold(responseThreshold uint32, maxCnt int) error { // ValidateTimeout verifies whether the given timeout and frequency are legal func ValidateTimeout(timeout int64, frequency uint64) error { if frequency < uint64(timeout) { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "timeout [%d] should be no more than frequency [%d]", timeout, frequency) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "timeout [%d] should be no more than frequency [%d]", timeout, frequency) } return nil } @@ -91,7 +92,7 @@ func ValidateTimeout(timeout int64, frequency uint64) error { // ValidateServiceFeeCap verifies whether the given service fee cap is legal func ValidateServiceFeeCap(serviceFeeCap sdk.Coins) error { if !serviceFeeCap.IsValid() { - return sdkerrors.Wrapf(ErrInvalidServiceFeeCap, serviceFeeCap.String()) + return errorsmod.Wrapf(ErrInvalidServiceFeeCap, serviceFeeCap.String()) } return nil } diff --git a/modules/random/handler.go b/modules/random/handler.go index 2854914a..ec596076 100644 --- a/modules/random/handler.go +++ b/modules/random/handler.go @@ -1,6 +1,7 @@ package random import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -21,7 +22,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } } } diff --git a/modules/random/keeper/grpc_query.go b/modules/random/keeper/grpc_query.go index 06cceffd..69fcb344 100644 --- a/modules/random/keeper/grpc_query.go +++ b/modules/random/keeper/grpc_query.go @@ -8,6 +8,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -65,11 +66,11 @@ func (k Keeper) RandomRequestQueue(c context.Context, req *types.QueryRandomRequ func queryRandomRequestQueue(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { var params types.QueryRandomRequestQueueParams if err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms); err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } if params.Height < 0 { - return nil, sdkerrors.Wrap(types.ErrInvalidHeight, string(rune(params.Height))) + return nil, errorsmod.Wrap(types.ErrInvalidHeight, string(rune(params.Height))) } var requests []types.Request @@ -84,7 +85,7 @@ func queryRandomRequestQueue(ctx sdk.Context, req abci.RequestQuery, k Keeper, l bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, requests) if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + return nil, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil diff --git a/modules/random/keeper/keeper.go b/modules/random/keeper/keeper.go index 7af1eb16..8f3002f3 100644 --- a/modules/random/keeper/keeper.go +++ b/modules/random/keeper/keeper.go @@ -5,10 +5,10 @@ import ( "github.com/cometbft/cometbft/libs/log" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/random/types" ) @@ -138,7 +138,7 @@ func (k Keeper) GetOracleRandRequest( bz := store.Get(types.KeyOracleRandomRequest(requestContextID)) if bz == nil { - return types.Request{}, sdkerrors.Wrap( + return types.Request{}, errorsmod.Wrap( types.ErrInvalidRequestContextID, hex.EncodeToString(requestContextID), ) @@ -162,7 +162,7 @@ func (k Keeper) GetRandom(ctx sdk.Context, reqID []byte) (types.Random, error) { bz := store.Get(types.KeyRandom(reqID)) if bz == nil { - return types.Random{}, sdkerrors.Wrap(types.ErrInvalidReqID, hex.EncodeToString(reqID)) + return types.Random{}, errorsmod.Wrap(types.ErrInvalidReqID, hex.EncodeToString(reqID)) } var random types.Random diff --git a/modules/random/types/errors.go b/modules/random/types/errors.go index dd889efb..e3f099b0 100644 --- a/modules/random/types/errors.go +++ b/modules/random/types/errors.go @@ -1,14 +1,14 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // random module sentinel errors var ( - ErrInvalidReqID = sdkerrors.Register(ModuleName, 2, "invalid request id") - ErrInvalidHeight = sdkerrors.Register(ModuleName, 3, "invalid height, must be greater than 0") - ErrInvalidServiceBindings = sdkerrors.Register(ModuleName, 4, "no service bindings available") - ErrInvalidRequestContextID = sdkerrors.Register(ModuleName, 5, "invalid request context id") - ErrInvalidServiceFeeCap = sdkerrors.Register(ModuleName, 6, "invalid service fee cap") + ErrInvalidReqID = errorsmod.Register(ModuleName, 2, "invalid request id") + ErrInvalidHeight = errorsmod.Register(ModuleName, 3, "invalid height, must be greater than 0") + ErrInvalidServiceBindings = errorsmod.Register(ModuleName, 4, "no service bindings available") + ErrInvalidRequestContextID = errorsmod.Register(ModuleName, 5, "invalid request context id") + ErrInvalidServiceFeeCap = errorsmod.Register(ModuleName, 6, "invalid service fee cap") ) diff --git a/modules/random/types/msgs.go b/modules/random/types/msgs.go index eae53305..02bf11a3 100644 --- a/modules/random/types/msgs.go +++ b/modules/random/types/msgs.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -37,7 +38,7 @@ func (msg MsgRequestRandom) Type() string { return TypeMsgRequestRandom } // ValidateBasic implements Msg. func (msg MsgRequestRandom) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Consumer); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid consumer address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid consumer address (%s)", err) } return ValidateServiceFeeCap(msg.ServiceFeeCap) } diff --git a/modules/random/types/request.go b/modules/random/types/request.go index 39980935..a2ce6180 100644 --- a/modules/random/types/request.go +++ b/modules/random/types/request.go @@ -4,6 +4,7 @@ import ( "encoding/hex" "fmt" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -40,11 +41,11 @@ func GenerateRequestID(r Request) []byte { // CheckReqID checks if the given request id is valid func CheckReqID(reqID string) error { if len(reqID) != 64 { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("invalid request id: %s", reqID)) + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("invalid request id: %s", reqID)) } if _, err := hex.DecodeString(reqID); err != nil { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("invalid request id: %s", reqID)) + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("invalid request id: %s", reqID)) } return nil diff --git a/modules/random/types/validation.go b/modules/random/types/validation.go index c4818950..46ccd6c9 100644 --- a/modules/random/types/validation.go +++ b/modules/random/types/validation.go @@ -1,14 +1,14 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // ValidateServiceFeeCap verifies whether the service fee cap is legal func ValidateServiceFeeCap(serviceFeeCap sdk.Coins) error { if !serviceFeeCap.IsValid() { - return sdkerrors.Wrapf(ErrInvalidServiceFeeCap, serviceFeeCap.String()) + return errorsmod.Wrapf(ErrInvalidServiceFeeCap, serviceFeeCap.String()) } return nil } diff --git a/modules/record/handler.go b/modules/record/handler.go index 079fa36b..b9fe058b 100644 --- a/modules/record/handler.go +++ b/modules/record/handler.go @@ -1,6 +1,7 @@ package record import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -21,7 +22,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized record message type: %T", msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized record message type: %T", msg) } } } diff --git a/modules/record/types/erros.go b/modules/record/types/erros.go index e5e8f078..6626d80b 100644 --- a/modules/record/types/erros.go +++ b/modules/record/types/erros.go @@ -1,10 +1,10 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // record module sentinel errors var ( - ErrUnknownRecord = sdkerrors.Register(ModuleName, 2, "unknown record") + ErrUnknownRecord = errorsmod.Register(ModuleName, 2, "unknown record") ) diff --git a/modules/record/types/msgs.go b/modules/record/types/msgs.go index 2e16aab5..cc1f0734 100644 --- a/modules/record/types/msgs.go +++ b/modules/record/types/msgs.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -37,11 +38,11 @@ func (msg MsgCreateRecord) GetSignBytes() []byte { // ValidateBasic implements Msg. func (msg MsgCreateRecord) ValidateBasic() error { if len(msg.Contents) == 0 { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "contents missing") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "contents missing") } if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } return ValidateContents(msg.Contents...) diff --git a/modules/record/types/validation.go b/modules/record/types/validation.go index ecb1bc64..bef06a9b 100644 --- a/modules/record/types/validation.go +++ b/modules/record/types/validation.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -8,10 +9,10 @@ import ( func ValidateContents(contents ...Content) error { for i, content := range contents { if len(content.Digest) == 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "content[%d] digest missing", i) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "content[%d] digest missing", i) } if len(content.DigestAlgo) == 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "content[%d] digest algo missing", i) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "content[%d] digest algo missing", i) } } return nil diff --git a/modules/service/handler.go b/modules/service/handler.go index 186b033b..35e29d71 100644 --- a/modules/service/handler.go +++ b/modules/service/handler.go @@ -1,6 +1,7 @@ package service import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -73,7 +74,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } } } diff --git a/modules/service/keeper/binding.go b/modules/service/keeper/binding.go index 5d0776be..fe1ad5c6 100644 --- a/modules/service/keeper/binding.go +++ b/modules/service/keeper/binding.go @@ -6,8 +6,8 @@ import ( gogotypes "github.com/cosmos/gogoproto/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" v1 "github.com/cosmos/cosmos-sdk/x/auth/migrations/v1" "github.com/irisnet/irismod/modules/service/types" @@ -25,16 +25,16 @@ func (k Keeper) AddServiceBinding( owner sdk.AccAddress, ) error { if _, found := k.GetServiceDefinition(ctx, serviceName); !found { - return sdkerrors.Wrap(types.ErrUnknownServiceDefinition, serviceName) + return errorsmod.Wrap(types.ErrUnknownServiceDefinition, serviceName) } if _, found := k.GetServiceBinding(ctx, serviceName, provider); found { - return sdkerrors.Wrap(types.ErrServiceBindingExists, "") + return errorsmod.Wrap(types.ErrServiceBindingExists, "") } currentOwner, found := k.GetOwner(ctx, provider) if found && !owner.Equals(currentOwner) { - return sdkerrors.Wrap(types.ErrNotAuthorized, "owner not matching") + return errorsmod.Wrap(types.ErrNotAuthorized, "owner not matching") } if err := k.validateDeposit(ctx, deposit); err != nil { @@ -43,7 +43,7 @@ func (k Keeper) AddServiceBinding( maxReqTimeout := k.MaxRequestTimeout(ctx) if qos > uint64(maxReqTimeout) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidQoS, "QoS [%d] must not be greater than maximum request timeout [%d]", qos, maxReqTimeout, @@ -61,11 +61,11 @@ func (k Keeper) AddServiceBinding( minDeposit, err := k.GetMinDeposit(ctx, parsedPricing) if err != nil { - return sdkerrors.Wrapf(types.ErrInvalidMinDeposit, "%s", err) + return errorsmod.Wrapf(types.ErrInvalidMinDeposit, "%s", err) } if !deposit.IsAllGTE(minDeposit) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidDeposit, "insufficient deposit: minimum deposit %s, %s got", minDeposit, deposit, @@ -146,7 +146,7 @@ func (k Keeper) UpdateServiceBinding( ) error { binding, found := k.GetServiceBinding(ctx, serviceName, provider) if !found { - return sdkerrors.Wrap(types.ErrUnknownServiceBinding, "") + return errorsmod.Wrap(types.ErrUnknownServiceBinding, "") } bindingOwner, err := sdk.AccAddressFromBech32(binding.Owner) @@ -155,7 +155,7 @@ func (k Keeper) UpdateServiceBinding( } if !owner.Equals(bindingOwner) { - return sdkerrors.Wrap(types.ErrNotAuthorized, "owner not matching") + return errorsmod.Wrap(types.ErrNotAuthorized, "owner not matching") } updated := false @@ -163,7 +163,7 @@ func (k Keeper) UpdateServiceBinding( if qos != 0 { maxReqTimeout := k.MaxRequestTimeout(ctx) if qos > uint64(maxReqTimeout) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidQoS, "QoS [%d] must not be greater than maximum request timeout [%d]", qos, maxReqTimeout, @@ -212,11 +212,11 @@ func (k Keeper) UpdateServiceBinding( if binding.Available && updated { minDeposit, err := k.GetMinDeposit(ctx, parsedPricing) if err != nil { - return sdkerrors.Wrapf(types.ErrInvalidMinDeposit, "%s", err) + return errorsmod.Wrapf(types.ErrInvalidMinDeposit, "%s", err) } if !binding.Deposit.IsAllGTE(minDeposit) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidDeposit, "insufficient deposit: minimum deposit %s, %s got", minDeposit, binding.Deposit, @@ -247,7 +247,7 @@ func (k Keeper) DisableServiceBinding( ) error { binding, found := k.GetServiceBinding(ctx, serviceName, provider) if !found { - return sdkerrors.Wrap(types.ErrUnknownServiceBinding, "") + return errorsmod.Wrap(types.ErrUnknownServiceBinding, "") } bindingOwner, err := sdk.AccAddressFromBech32(binding.Owner) @@ -256,11 +256,11 @@ func (k Keeper) DisableServiceBinding( } if !owner.Equals(bindingOwner) { - return sdkerrors.Wrap(types.ErrNotAuthorized, "owner not matching") + return errorsmod.Wrap(types.ErrNotAuthorized, "owner not matching") } if !binding.Available { - return sdkerrors.Wrap(types.ErrServiceBindingUnavailable, "") + return errorsmod.Wrap(types.ErrServiceBindingUnavailable, "") } binding.Available = false @@ -281,7 +281,7 @@ func (k Keeper) EnableServiceBinding( ) error { binding, found := k.GetServiceBinding(ctx, serviceName, provider) if !found { - return sdkerrors.Wrap(types.ErrUnknownServiceBinding, "") + return errorsmod.Wrap(types.ErrUnknownServiceBinding, "") } bindingOwner, err := sdk.AccAddressFromBech32(binding.Owner) @@ -290,11 +290,11 @@ func (k Keeper) EnableServiceBinding( } if !owner.Equals(bindingOwner) { - return sdkerrors.Wrap(types.ErrNotAuthorized, "owner not matching") + return errorsmod.Wrap(types.ErrNotAuthorized, "owner not matching") } if binding.Available { - return sdkerrors.Wrap(types.ErrServiceBindingAvailable, "") + return errorsmod.Wrap(types.ErrServiceBindingAvailable, "") } // add the deposit @@ -308,11 +308,11 @@ func (k Keeper) EnableServiceBinding( minDeposit, err := k.GetMinDeposit(ctx, k.GetPricing(ctx, serviceName, provider)) if err != nil { - return sdkerrors.Wrapf(types.ErrInvalidMinDeposit, "%s", err) + return errorsmod.Wrapf(types.ErrInvalidMinDeposit, "%s", err) } if !binding.Deposit.IsAllGTE(minDeposit) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidDeposit, "insufficient deposit: minimum deposit %s, %s got", minDeposit, binding.Deposit, @@ -344,7 +344,7 @@ func (k Keeper) RefundDeposit( ) error { binding, found := k.GetServiceBinding(ctx, serviceName, provider) if !found { - return sdkerrors.Wrap(types.ErrUnknownServiceBinding, "") + return errorsmod.Wrap(types.ErrUnknownServiceBinding, "") } bindingOwner, err := sdk.AccAddressFromBech32(binding.Owner) @@ -353,15 +353,15 @@ func (k Keeper) RefundDeposit( } if !owner.Equals(bindingOwner) { - return sdkerrors.Wrap(types.ErrNotAuthorized, "owner not matching") + return errorsmod.Wrap(types.ErrNotAuthorized, "owner not matching") } if binding.Available { - return sdkerrors.Wrap(types.ErrServiceBindingAvailable, "") + return errorsmod.Wrap(types.ErrServiceBindingAvailable, "") } if binding.Deposit.IsZero() { - return sdkerrors.Wrap(types.ErrInvalidDeposit, "the deposit of the service binding is zero") + return errorsmod.Wrap(types.ErrInvalidDeposit, "the deposit of the service binding is zero") } refundableTime := binding.DisabledTime.Add(k.ArbitrationTimeLimit(ctx)). @@ -369,7 +369,7 @@ func (k Keeper) RefundDeposit( currentTime := ctx.BlockHeader().Time if currentTime.Before(refundableTime) { - return sdkerrors.Wrapf(types.ErrIncorrectRefundTime, "%v", refundableTime) + return errorsmod.Wrapf(types.ErrIncorrectRefundTime, "%v", refundableTime) } // Send coins from the deposit module account to the owner's account @@ -658,7 +658,7 @@ func (k Keeper) validateDeposit(ctx sdk.Context, deposit sdk.Coins) error { baseDenom := k.BaseDenom(ctx) if len(deposit) != 1 || deposit[0].Denom != baseDenom { - return sdkerrors.Wrapf(types.ErrInvalidDeposit, "deposit only accepts %s", baseDenom) + return errorsmod.Wrapf(types.ErrInvalidDeposit, "deposit only accepts %s", baseDenom) } return nil @@ -672,7 +672,7 @@ func (k Keeper) validatePricing(ctx sdk.Context, pricing types.Pricing) error { baseDenom := k.BaseDenom(ctx) if priceDenom != baseDenom { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidPricing, "invalid denom: %s, service fee only accepts %s", priceDenom, @@ -682,7 +682,7 @@ func (k Keeper) validatePricing(ctx sdk.Context, pricing types.Pricing) error { } if supply := k.bankKeeper.GetSupply(ctx, priceDenom).Amount; !supply.IsPositive() { - return sdkerrors.Wrapf(types.ErrInvalidPricing, "invalid denom: %s", priceDenom) + return errorsmod.Wrapf(types.ErrInvalidPricing, "invalid denom: %s", priceDenom) } return nil diff --git a/modules/service/keeper/definition.go b/modules/service/keeper/definition.go index a09db51c..1aa3a32d 100644 --- a/modules/service/keeper/definition.go +++ b/modules/service/keeper/definition.go @@ -1,8 +1,8 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/service/types" ) @@ -18,7 +18,7 @@ func (k Keeper) AddServiceDefinition( schemas string, ) error { if _, found := k.GetServiceDefinition(ctx, name); found { - return sdkerrors.Wrap(types.ErrServiceDefinitionExists, name) + return errorsmod.Wrap(types.ErrServiceDefinitionExists, name) } svcDef := types.NewServiceDefinition(name, description, tags, author, authorDescription, schemas) diff --git a/modules/service/keeper/fees.go b/modules/service/keeper/fees.go index 985fca6c..565ee921 100644 --- a/modules/service/keeper/fees.go +++ b/modules/service/keeper/fees.go @@ -3,6 +3,7 @@ package keeper import ( gogotypes "github.com/cosmos/gogoproto/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" v1 "github.com/cosmos/cosmos-sdk/x/auth/migrations/v1" @@ -40,7 +41,7 @@ func (k Keeper) AddEarnedFee(ctx sdk.Context, provider sdk.AccAddress, fee sdk.C earnedFee, hasNeg := fee.SafeSub(taxCoins...) if hasNeg { - return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, "%s is less than %s", fee, taxCoins) + return errorsmod.Wrapf(sdkerrors.ErrInsufficientFunds, "%s is less than %s", fee, taxCoins) } // add the provider's earned fees @@ -138,13 +139,13 @@ func (k Keeper) WithdrawEarnedFees(ctx sdk.Context, owner, provider sdk.AccAddre if !provider.Empty() { providerOwner, _ := k.GetOwner(ctx, provider) if !owner.Equals(providerOwner) { - return sdkerrors.Wrap(types.ErrNotAuthorized, "owner not matching") + return errorsmod.Wrap(types.ErrNotAuthorized, "owner not matching") } } ownerEarnedFees, found := k.GetOwnerEarnedFees(ctx, owner) if !found { - return sdkerrors.Wrap(types.ErrNoEarnedFees, owner.String()) + return errorsmod.Wrap(types.ErrNoEarnedFees, owner.String()) } var withdrawFees sdk.Coins @@ -152,7 +153,7 @@ func (k Keeper) WithdrawEarnedFees(ctx sdk.Context, owner, provider sdk.AccAddre if !provider.Empty() { earnedFees, found := k.GetEarnedFees(ctx, provider) if !found { - return sdkerrors.Wrap(types.ErrNoEarnedFees, provider.String()) + return errorsmod.Wrap(types.ErrNoEarnedFees, provider.String()) } k.DeleteEarnedFees(ctx, provider) @@ -227,7 +228,7 @@ func (k Keeper) RefundServiceFees(ctx sdk.Context) error { consumer, err := sdk.AccAddressFromBech32(request.Consumer) if err != nil { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( sdkerrors.ErrInvalidAddress, "invalid consumer address (%s)", err, diff --git a/modules/service/keeper/grpc_query.go b/modules/service/keeper/grpc_query.go index 2c1866ca..9e502929 100644 --- a/modules/service/keeper/grpc_query.go +++ b/modules/service/keeper/grpc_query.go @@ -7,6 +7,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -30,7 +31,7 @@ func (k Keeper) Definition( ctx := sdk.UnwrapSDKContext(c) definition, found := k.GetServiceDefinition(ctx, req.ServiceName) if !found { - return nil, sdkerrors.Wrap(types.ErrUnknownServiceDefinition, req.ServiceName) + return nil, errorsmod.Wrap(types.ErrUnknownServiceDefinition, req.ServiceName) } return &types.QueryDefinitionResponse{ServiceDefinition: &definition}, nil @@ -46,7 +47,7 @@ func (k Keeper) Binding( provider, err := sdk.AccAddressFromBech32(req.Provider) if err != nil { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidAddress, "invalid provider address (%s)", err, @@ -57,7 +58,7 @@ func (k Keeper) Binding( binding, found := k.GetServiceBinding(ctx, req.ServiceName, provider) if !found { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrUnknownServiceBinding, "service: %s, provider: %s", req.ServiceName, @@ -99,7 +100,7 @@ func (k Keeper) Bindings( } else { owner, err := sdk.AccAddressFromBech32(req.Owner) if err != nil { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } bindingStore := prefix.NewStore(store, types.GetOwnerBindingsSubspace(owner, req.ServiceName)) pageRes, err = query.Paginate(bindingStore, shapePageRequest(req.Pagination), func(key []byte, value []byte) error { @@ -128,7 +129,7 @@ func (k Keeper) WithdrawAddress( owner, err := sdk.AccAddressFromBech32(req.Owner) if err != nil { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } ctx := sdk.UnwrapSDKContext(c) @@ -147,7 +148,7 @@ func (k Keeper) RequestContext( } if len(req.RequestContextId) != types.ContextIDLen { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidRequestContextID, "length of the request context ID must be %d in bytes", types.ContextIDLen, @@ -155,7 +156,7 @@ func (k Keeper) RequestContext( } requestContextId, err := hex.DecodeString(req.RequestContextId) if err != nil { - return nil, sdkerrors.Wrap( + return nil, errorsmod.Wrap( types.ErrInvalidRequestContextID, "request context ID must be a hex encoded string", ) @@ -177,7 +178,7 @@ func (k Keeper) Request( } if len(req.RequestId) != types.RequestIDLen { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidRequestID, "invalid length, expected: %d, got: %d", types.RequestIDLen, len(req.RequestId), @@ -186,7 +187,7 @@ func (k Keeper) Request( requestId, err := hex.DecodeString(req.RequestId) if err != nil { - return nil, sdkerrors.Wrap( + return nil, errorsmod.Wrap( types.ErrInvalidRequestContextID, "request ID must be a hex encoded string", ) @@ -208,7 +209,7 @@ func (k Keeper) Requests( provider, err := sdk.AccAddressFromBech32(req.Provider) if err != nil { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidAddress, "invalid provider address (%s)", err, @@ -249,7 +250,7 @@ func (k Keeper) RequestsByReqCtx( } if len(req.RequestContextId) != types.ContextIDLen { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidRequestContextID, "length of the request context ID must be %d in bytes", types.ContextIDLen, @@ -257,7 +258,7 @@ func (k Keeper) RequestsByReqCtx( } requestContextId, err := hex.DecodeString(req.RequestContextId) if err != nil { - return nil, sdkerrors.Wrap( + return nil, errorsmod.Wrap( types.ErrInvalidRequestContextID, "request context ID must be a hex encoded string", ) @@ -299,7 +300,7 @@ func (k Keeper) Response( ctx := sdk.UnwrapSDKContext(c) if len(req.RequestId) != types.RequestIDLen { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidRequestID, "invalid length, expected: %d, got: %d", types.RequestIDLen, len(req.RequestId), @@ -308,7 +309,7 @@ func (k Keeper) Response( requestId, err := hex.DecodeString(req.RequestId) if err != nil { - return nil, sdkerrors.Wrap( + return nil, errorsmod.Wrap( types.ErrInvalidRequestContextID, "request ID must be a hex encoded string", ) @@ -327,7 +328,7 @@ func (k Keeper) Responses( } if len(req.RequestContextId) != types.ContextIDLen { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidRequestContextID, "length of the request context ID must be %d in bytes", types.ContextIDLen, @@ -335,7 +336,7 @@ func (k Keeper) Responses( } requestContextId, err := hex.DecodeString(req.RequestContextId) if err != nil { - return nil, sdkerrors.Wrap( + return nil, errorsmod.Wrap( types.ErrInvalidRequestContextID, "request context ID must be a hex encoded string", ) @@ -376,7 +377,7 @@ func (k Keeper) EarnedFees( provider, err := sdk.AccAddressFromBech32(req.Provider) if err != nil { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidAddress, "invalid provider address (%s)", err, @@ -386,7 +387,7 @@ func (k Keeper) EarnedFees( ctx := sdk.UnwrapSDKContext(c) fees, found := k.GetEarnedFees(ctx, provider) if !found { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrNoEarnedFees, "no earned fees for %s", req.Provider, ) } @@ -409,7 +410,7 @@ func (k Keeper) Schema( case "result": schema = types.ResultSchema default: - return nil, sdkerrors.Wrap(types.ErrInvalidSchemaName, schema) + return nil, errorsmod.Wrap(types.ErrInvalidSchemaName, schema) } return &types.QuerySchemaResponse{Schema: schema}, nil diff --git a/modules/service/keeper/invocation.go b/modules/service/keeper/invocation.go index 76183577..73bd2266 100644 --- a/modules/service/keeper/invocation.go +++ b/modules/service/keeper/invocation.go @@ -10,6 +10,7 @@ import ( "github.com/cometbft/cometbft/crypto/tmhash" tmbytes "github.com/cometbft/cometbft/libs/bytes" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -22,7 +23,7 @@ func (k Keeper) RegisterResponseCallback( respCallback types.ResponseCallback, ) error { if _, ok := k.respCallbacks[moduleName]; ok { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrCallbackRegistered, "%s already registered for module %s", "response callback", @@ -38,7 +39,7 @@ func (k Keeper) RegisterResponseCallback( // RegisterStateCallback registers a module callback for state handling func (k Keeper) RegisterStateCallback(moduleName string, stateCallback types.StateCallback) error { if _, ok := k.stateCallbacks[moduleName]; ok { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrCallbackRegistered, "%s already registered for module %s", "state callback", @@ -86,7 +87,7 @@ func (k Keeper) CreateRequestContext( } if responseThreshold < 1 || int(responseThreshold) > len(providers) { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidResponseThreshold, "response threshold [%d] must be between [1,%d]", responseThreshold, @@ -97,7 +98,7 @@ func (k Keeper) CreateRequestContext( _, found := k.GetServiceDefinition(ctx, serviceName) if !found { - return nil, sdkerrors.Wrap(types.ErrUnknownServiceDefinition, serviceName) + return nil, errorsmod.Wrap(types.ErrUnknownServiceDefinition, serviceName) } if err := types.ValidateRequestInput(input); err != nil { @@ -110,7 +111,7 @@ func (k Keeper) CreateRequestContext( maxRequestTimeout := k.MaxRequestTimeout(ctx) if timeout > maxRequestTimeout { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrInvalidTimeout, "timeout [%d] must not be greater than the max request timeout [%d]", timeout, @@ -168,7 +169,7 @@ func (k Keeper) UpdateRequestContext( } requestContext, found := k.GetRequestContext(ctx, requestContextID) if !found { - return sdkerrors.Wrap(types.ErrUnknownRequestContext, requestContextID.String()) + return errorsmod.Wrap(types.ErrUnknownRequestContext, requestContextID.String()) } // check authority when called by module @@ -196,7 +197,7 @@ func (k Keeper) UpdateRequestContext( } if respThreshold > uint32(len(pds)) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidResponseThreshold, "response threshold [%d] must be between [1,%d]", respThreshold, @@ -219,7 +220,7 @@ func (k Keeper) UpdateRequestContext( maxRequestTimeout := k.MaxRequestTimeout(ctx) if timeout > maxRequestTimeout { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidTimeout, "timeout [%d] must not be greater than the max request timeout [%d]", timeout, @@ -236,7 +237,7 @@ func (k Keeper) UpdateRequestContext( } if repeatedFreq < uint64(timeout) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidRepeatedFreq, "repeated frequency [%d] must not be less than the timeout [%d]", repeatedFreq, @@ -245,7 +246,7 @@ func (k Keeper) UpdateRequestContext( } if repeatedTotal >= 1 && repeatedTotal < int64(requestContext.BatchCounter) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidRepeatedTotal, "updated repeated total [%d] must not be less than the current batch counter [%d]", repeatedTotal, @@ -282,7 +283,7 @@ func (k Keeper) PauseRequestContext( ) error { requestContext, found := k.GetRequestContext(ctx, requestContextID) if !found { - return sdkerrors.Wrap(types.ErrUnknownRequestContext, requestContextID.String()) + return errorsmod.Wrap(types.ErrUnknownRequestContext, requestContextID.String()) } // check authority when called by module @@ -314,7 +315,7 @@ func (k Keeper) StartRequestContext( ) error { requestContext, found := k.GetRequestContext(ctx, requestContextID) if !found { - return sdkerrors.Wrap(types.ErrUnknownRequestContext, requestContextID.String()) + return errorsmod.Wrap(types.ErrUnknownRequestContext, requestContextID.String()) } // check authority when called by module @@ -348,7 +349,7 @@ func (k Keeper) KillRequestContext( ) error { requestContext, found := k.GetRequestContext(ctx, requestContextID) if !found { - return sdkerrors.Wrap(types.ErrUnknownRequestContext, requestContextID.String()) + return errorsmod.Wrap(types.ErrUnknownRequestContext, requestContextID.String()) } // check authority when called by module @@ -1013,24 +1014,24 @@ func (k Keeper) AddResponse( ) { request, found := k.GetRequest(ctx, requestID) if !found { - return request, response, sdkerrors.Wrap(types.ErrUnknownRequest, requestID.String()) + return request, response, errorsmod.Wrap(types.ErrUnknownRequest, requestID.String()) } requestProvider, _ := sdk.AccAddressFromBech32(request.Provider) if !provider.Equals(requestProvider) { - return request, response, sdkerrors.Wrap( + return request, response, errorsmod.Wrap( types.ErrInvalidResponse, "provider does not match", ) } if !k.IsRequestActive(ctx, requestID) { - return request, response, sdkerrors.Wrap(types.ErrInvalidResponse, "request is not active") + return request, response, errorsmod.Wrap(types.ErrInvalidResponse, "request is not active") } if len(output) > 0 { if err := types.ValidateResponseOutput(output); err != nil { - return request, response, sdkerrors.Wrap(types.ErrInvalidResponseOutput, err.Error()) + return request, response, errorsmod.Wrap(types.ErrInvalidResponseOutput, err.Error()) } } @@ -1235,7 +1236,7 @@ func (k Keeper) Slash(ctx sdk.Context, requestID tmbytes.HexBytes) error { deposit, hasNeg := binding.Deposit.SafeSub(slashedCoins...) if hasNeg { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( sdkerrors.ErrInsufficientFunds, "%s is less than %s", binding.Deposit.String(), @@ -1279,15 +1280,15 @@ func (k Keeper) CheckAuthority( ) error { requestContext, found := k.GetRequestContext(ctx, requestContextID) if !found { - return sdkerrors.Wrap(types.ErrUnknownRequestContext, requestContextID.String()) + return errorsmod.Wrap(types.ErrUnknownRequestContext, requestContextID.String()) } if consumer.String() != requestContext.Consumer { - return sdkerrors.Wrapf(types.ErrNotAuthorized, "consumer not matching") + return errorsmod.Wrapf(types.ErrNotAuthorized, "consumer not matching") } if checkModule && len(requestContext.ModuleName) > 0 { - return sdkerrors.Wrapf(types.ErrNotAuthorized, "not authorized operation") + return errorsmod.Wrapf(types.ErrNotAuthorized, "not authorized operation") } return nil @@ -1297,7 +1298,7 @@ func (k Keeper) CheckAuthority( func (k Keeper) GetResponseCallback(moduleName string) (types.ResponseCallback, error) { respCallback, ok := k.respCallbacks[moduleName] if !ok { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrCallbackNotRegistered, "%s not registered for module %s", "response callback", @@ -1312,7 +1313,7 @@ func (k Keeper) GetResponseCallback(moduleName string) (types.ResponseCallback, func (k Keeper) GetStateCallback(moduleName string) (types.StateCallback, error) { stateCallback, ok := k.stateCallbacks[moduleName] if !ok { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrCallbackNotRegistered, "%s not registered for module %s", "state callback", @@ -1347,7 +1348,7 @@ func (k Keeper) validateServiceFeeCap(ctx sdk.Context, serviceFeeCap sdk.Coins) baseDenom := k.BaseDenom(ctx) if len(serviceFeeCap) != 1 || serviceFeeCap[0].Denom != baseDenom { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidServiceFeeCap, "service fee cap only accepts %s", baseDenom, diff --git a/modules/service/keeper/module_service.go b/modules/service/keeper/module_service.go index bc640d81..a2354bce 100644 --- a/modules/service/keeper/module_service.go +++ b/modules/service/keeper/module_service.go @@ -3,6 +3,7 @@ package keeper import ( tmbytes "github.com/cometbft/cometbft/libs/bytes" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -12,7 +13,7 @@ import ( // RegisterModuleService registers a module service func (k Keeper) RegisterModuleService(moduleName string, moduleService *types.ModuleService) error { if _, ok := k.moduleServices[moduleName]; ok { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrModuleServiceRegistered, "%s already registered for module %s", "module service", @@ -57,7 +58,7 @@ func (k Keeper) RequestModuleService( ) error { requestContext, found := k.GetRequestContext(ctx, reqContextID) if !found { - return sdkerrors.Wrap(types.ErrUnknownRequestContext, reqContextID.String()) + return errorsmod.Wrap(types.ErrUnknownRequestContext, reqContextID.String()) } requestContextConsumer, _ := sdk.AccAddressFromBech32(requestContext.Consumer) @@ -66,7 +67,7 @@ func (k Keeper) RequestModuleService( for i, provider := range requestContext.Providers { pd, err := sdk.AccAddressFromBech32(provider) if err != nil { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( sdkerrors.ErrInvalidAddress, "invalid provider address: %s", provider, diff --git a/modules/service/keeper/msg_server.go b/modules/service/keeper/msg_server.go index 7009c196..62f2dbfc 100644 --- a/modules/service/keeper/msg_server.go +++ b/modules/service/keeper/msg_server.go @@ -6,6 +6,7 @@ import ( tmbytes "github.com/cometbft/cometbft/libs/bytes" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -59,7 +60,7 @@ func (m msgServer) BindService( msg *types.MsgBindService, ) (*types.MsgBindServiceResponse, error) { if _, _, found := m.k.GetModuleServiceByServiceName(msg.ServiceName); found { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( types.ErrBindModuleService, "module service %s", msg.ServiceName, @@ -144,7 +145,7 @@ func (m msgServer) SetWithdrawAddress( } if m.k.blockedAddrs[msg.WithdrawAddress] { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrUnauthorized, "%s is a module account", msg.WithdrawAddress, @@ -537,7 +538,7 @@ func (m msgServer) UpdateParams( msg *types.MsgUpdateParams, ) (*types.MsgUpdateParamsResponse, error) { if m.k.authority != msg.Authority { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrUnauthorized, "invalid authority; expected %s, got %s", m.k.authority, diff --git a/modules/service/keeper/oracle_price.go b/modules/service/keeper/oracle_price.go index 5e8c8606..acd2443d 100644 --- a/modules/service/keeper/oracle_price.go +++ b/modules/service/keeper/oracle_price.go @@ -5,8 +5,8 @@ import ( "github.com/tidwall/gjson" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/service/types" ) @@ -50,7 +50,7 @@ func (k Keeper) GetExchangedPrice( func (k Keeper) GetExchangeRate(ctx sdk.Context, quoteDenom, baseDenom string) (sdk.Dec, error) { exchangeRateSvc, exist := k.GetModuleServiceByModuleName(types.RegisterModuleName) if !exist { - return sdk.Dec{}, sdkerrors.Wrapf(types.ErrInvalidModuleService, "module service does not exist: %s", types.RegisterModuleName) + return sdk.Dec{}, errorsmod.Wrapf(types.ErrInvalidModuleService, "module service does not exist: %s", types.RegisterModuleName) } inputBody := fmt.Sprintf(`{"pair":"%s-%s"}`, quoteDenom, baseDenom) @@ -61,7 +61,7 @@ func (k Keeper) GetExchangeRate(ctx sdk.Context, quoteDenom, baseDenom string) ( result, output := exchangeRateSvc.ReuquestService(ctx, input) if code, msg := CheckResult(result); code != types.ResultOK { - return sdk.Dec{}, sdkerrors.Wrapf(types.ErrInvalidModuleService, msg) + return sdk.Dec{}, errorsmod.Wrapf(types.ErrInvalidModuleService, msg) } outputBody := gjson.Get(output, types.PATH_BODY).String() @@ -75,7 +75,7 @@ func (k Keeper) GetExchangeRate(ctx sdk.Context, quoteDenom, baseDenom string) ( } if rate.IsZero() { - return sdk.Dec{}, sdkerrors.Wrapf(types.ErrInvalidResponseOutputBody, "rate can not be zero") + return sdk.Dec{}, errorsmod.Wrapf(types.ErrInvalidResponseOutputBody, "rate can not be zero") } return rate, nil diff --git a/modules/service/keeper/pagination_test.go b/modules/service/keeper/pagination_test.go index 5558257c..b1d6d880 100644 --- a/modules/service/keeper/pagination_test.go +++ b/modules/service/keeper/pagination_test.go @@ -1,9 +1,10 @@ package keeper import ( + "testing" + "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" - "testing" ) var ShapePageRequest = shapePageRequest diff --git a/modules/service/types/binding.go b/modules/service/types/binding.go index cac3ca7d..77ccf1f4 100644 --- a/modules/service/types/binding.go +++ b/modules/service/types/binding.go @@ -4,8 +4,8 @@ import ( "encoding/json" "time" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // NewServiceBinding creates a new ServiceBinding instance @@ -77,12 +77,12 @@ func GetDiscountByVolume(pricing Pricing, volume uint64) sdk.Dec { func ParsePricing(pricing string) (p Pricing, err error) { var rawPricing RawPricing if err := json.Unmarshal([]byte(pricing), &rawPricing); err != nil { - return p, sdkerrors.Wrapf(ErrInvalidPricing, "failed to unmarshal the pricing: %s", err.Error()) + return p, errorsmod.Wrapf(ErrInvalidPricing, "failed to unmarshal the pricing: %s", err.Error()) } priceCoin, err := sdk.ParseCoinNormalized(rawPricing.Price) if err != nil { - return p, sdkerrors.Wrapf(ErrInvalidPricing, "invalid price: %s", err.Error()) + return p, errorsmod.Wrapf(ErrInvalidPricing, "invalid price: %s", err.Error()) } p.Price = sdk.Coins{priceCoin} @@ -99,7 +99,7 @@ func CheckPricing(pricing Pricing) error { // p[i].StartTime >= p[i-1].EndTime for i, p := range pricing.PromotionsByTime { if !p.EndTime.After(p.StartTime) || (i > 0 && p.StartTime.Before(pricing.PromotionsByTime[i-1].EndTime)) { - return sdkerrors.Wrapf(ErrInvalidPricing, "invalid timing promotion %d", i) + return errorsmod.Wrapf(ErrInvalidPricing, "invalid timing promotion %d", i) } } @@ -107,7 +107,7 @@ func CheckPricing(pricing Pricing) error { // p[i].Volume > p[i-1].Volume for i, p := range pricing.PromotionsByVolume { if i > 0 && p.Volume < pricing.PromotionsByVolume[i-1].Volume { - return sdkerrors.Wrapf(ErrInvalidPricing, "invalid volume promotion %d", i) + return errorsmod.Wrapf(ErrInvalidPricing, "invalid volume promotion %d", i) } } diff --git a/modules/service/types/errors.go b/modules/service/types/errors.go index 1690ec53..5729258b 100644 --- a/modules/service/types/errors.go +++ b/modules/service/types/errors.go @@ -1,59 +1,59 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // service module sentinel errors var ( - ErrInvalidServiceName = sdkerrors.Register(ModuleName, 2, "invalid service name, must contain alphanumeric characters, _ and - only,length greater than 0 and less than or equal to 70") - ErrInvalidDescription = sdkerrors.Register(ModuleName, 3, "invalid description") - ErrInvalidTags = sdkerrors.Register(ModuleName, 4, "invalid tags") - ErrInvalidSchemas = sdkerrors.Register(ModuleName, 5, "invalid schemas") - ErrUnknownServiceDefinition = sdkerrors.Register(ModuleName, 6, "unknown service definition") - ErrServiceDefinitionExists = sdkerrors.Register(ModuleName, 7, "service definition already exists") + ErrInvalidServiceName = errorsmod.Register(ModuleName, 2, "invalid service name, must contain alphanumeric characters, _ and - only,length greater than 0 and less than or equal to 70") + ErrInvalidDescription = errorsmod.Register(ModuleName, 3, "invalid description") + ErrInvalidTags = errorsmod.Register(ModuleName, 4, "invalid tags") + ErrInvalidSchemas = errorsmod.Register(ModuleName, 5, "invalid schemas") + ErrUnknownServiceDefinition = errorsmod.Register(ModuleName, 6, "unknown service definition") + ErrServiceDefinitionExists = errorsmod.Register(ModuleName, 7, "service definition already exists") - ErrInvalidDeposit = sdkerrors.Register(ModuleName, 8, "invalid deposit") - ErrInvalidMinDeposit = sdkerrors.Register(ModuleName, 9, "invalid minimum deposit") - ErrInvalidPricing = sdkerrors.Register(ModuleName, 10, "invalid pricing") - ErrInvalidQoS = sdkerrors.Register(ModuleName, 11, "invalid QoS") - ErrInvalidOptions = sdkerrors.Register(ModuleName, 12, "invalid options") - ErrServiceBindingExists = sdkerrors.Register(ModuleName, 13, "service binding already exists") - ErrUnknownServiceBinding = sdkerrors.Register(ModuleName, 14, "unknown service binding") - ErrServiceBindingUnavailable = sdkerrors.Register(ModuleName, 15, "service binding unavailable") - ErrServiceBindingAvailable = sdkerrors.Register(ModuleName, 16, "service binding available") - ErrIncorrectRefundTime = sdkerrors.Register(ModuleName, 17, "incorrect refund time") + ErrInvalidDeposit = errorsmod.Register(ModuleName, 8, "invalid deposit") + ErrInvalidMinDeposit = errorsmod.Register(ModuleName, 9, "invalid minimum deposit") + ErrInvalidPricing = errorsmod.Register(ModuleName, 10, "invalid pricing") + ErrInvalidQoS = errorsmod.Register(ModuleName, 11, "invalid QoS") + ErrInvalidOptions = errorsmod.Register(ModuleName, 12, "invalid options") + ErrServiceBindingExists = errorsmod.Register(ModuleName, 13, "service binding already exists") + ErrUnknownServiceBinding = errorsmod.Register(ModuleName, 14, "unknown service binding") + ErrServiceBindingUnavailable = errorsmod.Register(ModuleName, 15, "service binding unavailable") + ErrServiceBindingAvailable = errorsmod.Register(ModuleName, 16, "service binding available") + ErrIncorrectRefundTime = errorsmod.Register(ModuleName, 17, "incorrect refund time") - ErrInvalidServiceFeeCap = sdkerrors.Register(ModuleName, 18, "invalid service fee cap") - ErrInvalidProviders = sdkerrors.Register(ModuleName, 19, "invalid providers") - ErrInvalidTimeout = sdkerrors.Register(ModuleName, 20, "invalid timeout") - ErrInvalidRepeatedFreq = sdkerrors.Register(ModuleName, 21, "invalid repeated frequency") - ErrInvalidRepeatedTotal = sdkerrors.Register(ModuleName, 22, "invalid repeated total count") - ErrInvalidResponseThreshold = sdkerrors.Register(ModuleName, 23, "invalid response threshold") - ErrInvalidResponse = sdkerrors.Register(ModuleName, 24, "invalid response") - ErrInvalidRequestID = sdkerrors.Register(ModuleName, 25, "invalid request ID") - ErrUnknownRequest = sdkerrors.Register(ModuleName, 26, "unknown request") - ErrUnknownResponse = sdkerrors.Register(ModuleName, 27, "unknown response") - ErrUnknownRequestContext = sdkerrors.Register(ModuleName, 28, "unknown request context") - ErrInvalidRequestContextID = sdkerrors.Register(ModuleName, 29, "invalid request context ID") - ErrRequestContextNonRepeated = sdkerrors.Register(ModuleName, 30, "request context non repeated") - ErrRequestContextNotRunning = sdkerrors.Register(ModuleName, 31, "request context not running") - ErrRequestContextNotPaused = sdkerrors.Register(ModuleName, 32, "request context not paused") - ErrRequestContextCompleted = sdkerrors.Register(ModuleName, 33, "request context completed") - ErrCallbackRegistered = sdkerrors.Register(ModuleName, 34, "callback registered") - ErrCallbackNotRegistered = sdkerrors.Register(ModuleName, 35, "callback not registered") - ErrNoEarnedFees = sdkerrors.Register(ModuleName, 36, "no earned fees") + ErrInvalidServiceFeeCap = errorsmod.Register(ModuleName, 18, "invalid service fee cap") + ErrInvalidProviders = errorsmod.Register(ModuleName, 19, "invalid providers") + ErrInvalidTimeout = errorsmod.Register(ModuleName, 20, "invalid timeout") + ErrInvalidRepeatedFreq = errorsmod.Register(ModuleName, 21, "invalid repeated frequency") + ErrInvalidRepeatedTotal = errorsmod.Register(ModuleName, 22, "invalid repeated total count") + ErrInvalidResponseThreshold = errorsmod.Register(ModuleName, 23, "invalid response threshold") + ErrInvalidResponse = errorsmod.Register(ModuleName, 24, "invalid response") + ErrInvalidRequestID = errorsmod.Register(ModuleName, 25, "invalid request ID") + ErrUnknownRequest = errorsmod.Register(ModuleName, 26, "unknown request") + ErrUnknownResponse = errorsmod.Register(ModuleName, 27, "unknown response") + ErrUnknownRequestContext = errorsmod.Register(ModuleName, 28, "unknown request context") + ErrInvalidRequestContextID = errorsmod.Register(ModuleName, 29, "invalid request context ID") + ErrRequestContextNonRepeated = errorsmod.Register(ModuleName, 30, "request context non repeated") + ErrRequestContextNotRunning = errorsmod.Register(ModuleName, 31, "request context not running") + ErrRequestContextNotPaused = errorsmod.Register(ModuleName, 32, "request context not paused") + ErrRequestContextCompleted = errorsmod.Register(ModuleName, 33, "request context completed") + ErrCallbackRegistered = errorsmod.Register(ModuleName, 34, "callback registered") + ErrCallbackNotRegistered = errorsmod.Register(ModuleName, 35, "callback not registered") + ErrNoEarnedFees = errorsmod.Register(ModuleName, 36, "no earned fees") - ErrInvalidRequestInput = sdkerrors.Register(ModuleName, 37, "invalid request input") - ErrInvalidResponseOutput = sdkerrors.Register(ModuleName, 38, "invalid response output") - ErrInvalidResponseResult = sdkerrors.Register(ModuleName, 39, "invalid response result") + ErrInvalidRequestInput = errorsmod.Register(ModuleName, 37, "invalid request input") + ErrInvalidResponseOutput = errorsmod.Register(ModuleName, 38, "invalid response output") + ErrInvalidResponseResult = errorsmod.Register(ModuleName, 39, "invalid response result") - ErrInvalidSchemaName = sdkerrors.Register(ModuleName, 40, "invalid service schema name") - ErrNotAuthorized = sdkerrors.Register(ModuleName, 41, "not authorized") + ErrInvalidSchemaName = errorsmod.Register(ModuleName, 40, "invalid service schema name") + ErrNotAuthorized = errorsmod.Register(ModuleName, 41, "not authorized") - ErrModuleServiceRegistered = sdkerrors.Register(ModuleName, 42, "module service registered") - ErrInvalidModuleService = sdkerrors.Register(ModuleName, 43, "invalid module service") - ErrBindModuleService = sdkerrors.Register(ModuleName, 44, "can not bind module service") - ErrInvalidRequestInputBody = sdkerrors.Register(ModuleName, 45, "invalid request input body") - ErrInvalidResponseOutputBody = sdkerrors.Register(ModuleName, 46, "invalid response output body") + ErrModuleServiceRegistered = errorsmod.Register(ModuleName, 42, "module service registered") + ErrInvalidModuleService = errorsmod.Register(ModuleName, 43, "invalid module service") + ErrBindModuleService = errorsmod.Register(ModuleName, 44, "can not bind module service") + ErrInvalidRequestInputBody = errorsmod.Register(ModuleName, 45, "invalid request input body") + ErrInvalidResponseOutputBody = errorsmod.Register(ModuleName, 46, "invalid response output body") ) diff --git a/modules/service/types/invocation.go b/modules/service/types/invocation.go index 5cbee447..bddcfa6a 100644 --- a/modules/service/types/invocation.go +++ b/modules/service/types/invocation.go @@ -10,8 +10,8 @@ import ( tmbytes "github.com/cometbft/cometbft/libs/bytes" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // NewRequestContext creates a new RequestContext instance @@ -196,7 +196,7 @@ func ParseResult(result string) (Result, error) { var r Result if err := json.Unmarshal([]byte(result), &r); err != nil { - return r, sdkerrors.Wrapf( + return r, errorsmod.Wrapf( ErrInvalidResponseResult, "failed to unmarshal the result: %s", err, diff --git a/modules/service/types/msgs.go b/modules/service/types/msgs.go index 46ea6bdb..f91589b0 100644 --- a/modules/service/types/msgs.go +++ b/modules/service/types/msgs.go @@ -1,8 +1,8 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // Message types for the service module @@ -846,7 +846,7 @@ func (m *MsgUpdateParams) GetSignBytes() []byte { // ValidateBasic executes sanity validation on the provided data func (m *MsgUpdateParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return sdkerrors.Wrap(err, "invalid authority address") + return errorsmod.Wrap(err, "invalid authority address") } return m.Params.Validate() } diff --git a/modules/service/types/params.go b/modules/service/types/params.go index 45320525..020527b3 100644 --- a/modules/service/types/params.go +++ b/modules/service/types/params.go @@ -11,23 +11,13 @@ import ( // Service params default values var ( - DefaultMaxRequestTimeout = int64(100) - DefaultMinDepositMultiple = int64(1000) - DefaultMinDeposit = sdk.NewCoins( - sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(5000)), - ) // 5000stake - DefaultServiceFeeTax = sdk.NewDecWithPrec( - 5, - 2, - ) // 5% - DefaultSlashFraction = sdk.NewDecWithPrec( - 1, - 3, - ) // 0.1% - DefaultComplaintRetrospect = 15 * 24 * time.Hour // 15 days - DefaultArbitrationTimeLimit = 5 * 24 * time.Hour // 5 days + DefaultMaxRequestTimeout = int64(100) + DefaultMinDepositMultiple = int64(1000) + DefaultServiceFeeTax = sdk.NewDecWithPrec(5, 2) // 5% + DefaultSlashFraction = sdk.NewDecWithPrec(1, 3) // 0.1% + DefaultComplaintRetrospect = 15 * 24 * time.Hour // 15 days + DefaultArbitrationTimeLimit = 5 * 24 * time.Hour // 5 days DefaultTxSizeLimit = uint64(4000) - DefaultBaseDenom = sdk.DefaultBondDenom DefaultRestrictedServiceFeeDenom = false ) @@ -63,13 +53,15 @@ func DefaultParams() Params { return NewParams( DefaultMaxRequestTimeout, DefaultMinDepositMultiple, - DefaultMinDeposit, + sdk.NewCoins( + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(5000)), + ), DefaultServiceFeeTax, DefaultSlashFraction, DefaultComplaintRetrospect, DefaultArbitrationTimeLimit, DefaultTxSizeLimit, - DefaultBaseDenom, + sdk.DefaultBondDenom, DefaultRestrictedServiceFeeDenom, ) } diff --git a/modules/service/types/schema.go b/modules/service/types/schema.go index 12237190..7f09da05 100644 --- a/modules/service/types/schema.go +++ b/modules/service/types/schema.go @@ -7,7 +7,7 @@ import ( "github.com/xeipuuv/gojsonschema" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) const PATH_BODY = "body" @@ -21,7 +21,7 @@ type ServiceSchemas struct { // ValidateServiceSchemas validates the given service schemas func ValidateServiceSchemas(schemas string) error { if len(schemas) == 0 { - return sdkerrors.Wrap(ErrInvalidSchemas, "schemas missing") + return errorsmod.Wrap(ErrInvalidSchemas, "schemas missing") } svcSchemas, err := parseServiceSchemas(schemas) @@ -43,11 +43,11 @@ func ValidateServiceSchemas(schemas string) error { // ValidateBindingPricing validates the given pricing against the Pricing JSON Schema func ValidateBindingPricing(pricing string) error { if len(pricing) == 0 { - return sdkerrors.Wrap(ErrInvalidPricing, "pricing missing") + return errorsmod.Wrap(ErrInvalidPricing, "pricing missing") } if err := validateDocument([]byte(PricingSchema), pricing); err != nil { - return sdkerrors.Wrap(ErrInvalidPricing, err.Error()) + return errorsmod.Wrap(ErrInvalidPricing, err.Error()) } return nil @@ -56,7 +56,7 @@ func ValidateBindingPricing(pricing string) error { // ValidateRequestInput validates the request input against the input schema func ValidateRequestInput(input string) error { if err := validateDocument([]byte(InputSchema), input); err != nil { - return sdkerrors.Wrap(ErrInvalidRequestInput, err.Error()) + return errorsmod.Wrap(ErrInvalidRequestInput, err.Error()) } return nil } @@ -68,7 +68,7 @@ func ValidateRequestInputBody(schemas string, inputBody string) error { } if err := validateDocument(inputSchemaBz, inputBody); err != nil { - return sdkerrors.Wrap(ErrInvalidRequestInputBody, err.Error()) + return errorsmod.Wrap(ErrInvalidRequestInputBody, err.Error()) } return nil @@ -77,11 +77,11 @@ func ValidateRequestInputBody(schemas string, inputBody string) error { // ValidateResponseResult validates the response result against the result schema func ValidateResponseResult(result string) error { if len(result) == 0 { - return sdkerrors.Wrap(ErrInvalidResponseResult, "result missing") + return errorsmod.Wrap(ErrInvalidResponseResult, "result missing") } if err := validateDocument([]byte(ResultSchema), result); err != nil { - return sdkerrors.Wrap(ErrInvalidResponseResult, err.Error()) + return errorsmod.Wrap(ErrInvalidResponseResult, err.Error()) } return nil @@ -90,7 +90,7 @@ func ValidateResponseResult(result string) error { // ValidateResponseOutput validates the response output against the output schema func ValidateResponseOutput(output string) error { if err := validateDocument([]byte(OutputSchema), output); err != nil { - return sdkerrors.Wrap(ErrInvalidResponseOutput, err.Error()) + return errorsmod.Wrap(ErrInvalidResponseOutput, err.Error()) } return nil } @@ -102,7 +102,7 @@ func ValidateResponseOutputBody(schemas string, outputBody string) error { } if err := validateDocument(outputSchemaBz, outputBody); err != nil { - return sdkerrors.Wrap(ErrInvalidResponseOutputBody, err.Error()) + return errorsmod.Wrap(ErrInvalidResponseOutputBody, err.Error()) } return nil @@ -111,11 +111,11 @@ func ValidateResponseOutputBody(schemas string, outputBody string) error { func validateInputSchema(inputSchema map[string]interface{}) error { inputSchemaBz, err := json.Marshal(inputSchema) if err != nil { - return sdkerrors.Wrap(ErrInvalidSchemas, fmt.Sprintf("failed to marshal the input schema: %s", err)) + return errorsmod.Wrap(ErrInvalidSchemas, fmt.Sprintf("failed to marshal the input schema: %s", err)) } if _, err = gojsonschema.NewSchema(gojsonschema.NewBytesLoader(inputSchemaBz)); err != nil { - return sdkerrors.Wrap(ErrInvalidSchemas, fmt.Sprintf("invalid input schema: %s", err)) + return errorsmod.Wrap(ErrInvalidSchemas, fmt.Sprintf("invalid input schema: %s", err)) } return nil @@ -124,11 +124,11 @@ func validateInputSchema(inputSchema map[string]interface{}) error { func validateOutputSchema(outputSchema map[string]interface{}) error { outputSchemaBz, err := json.Marshal(outputSchema) if err != nil { - return sdkerrors.Wrap(ErrInvalidSchemas, fmt.Sprintf("failed to marshal the output schema: %s", err)) + return errorsmod.Wrap(ErrInvalidSchemas, fmt.Sprintf("failed to marshal the output schema: %s", err)) } if _, err = gojsonschema.NewSchema(gojsonschema.NewBytesLoader(outputSchemaBz)); err != nil { - return sdkerrors.Wrap(ErrInvalidSchemas, fmt.Sprintf("invalid output schema: %s", err)) + return errorsmod.Wrap(ErrInvalidSchemas, fmt.Sprintf("invalid output schema: %s", err)) } return nil @@ -138,7 +138,7 @@ func validateOutputSchema(outputSchema map[string]interface{}) error { func parseServiceSchemas(schemas string) (ServiceSchemas, error) { var svcSchemas ServiceSchemas if err := json.Unmarshal([]byte(schemas), &svcSchemas); err != nil { - return svcSchemas, sdkerrors.Wrap(ErrInvalidSchemas, fmt.Sprintf("failed to unmarshal the schemas: %s", err)) + return svcSchemas, errorsmod.Wrap(ErrInvalidSchemas, fmt.Sprintf("failed to unmarshal the schemas: %s", err)) } return svcSchemas, nil @@ -153,7 +153,7 @@ func parseInputSchema(schemas string) ([]byte, error) { inputSchemaBz, err := json.Marshal(svcSchemas.Input) if err != nil { - return nil, sdkerrors.Wrap(ErrInvalidSchemas, fmt.Sprintf("failed to marshal the input schema: %s", err)) + return nil, errorsmod.Wrap(ErrInvalidSchemas, fmt.Sprintf("failed to marshal the input schema: %s", err)) } return inputSchemaBz, nil @@ -168,7 +168,7 @@ func parseOutputSchema(schemas string) ([]byte, error) { outputSchemaBz, err := json.Marshal(svcSchemas.Output) if err != nil { - return nil, sdkerrors.Wrap(ErrInvalidSchemas, fmt.Sprintf("failed to marshal the output schema: %s", err)) + return nil, errorsmod.Wrap(ErrInvalidSchemas, fmt.Sprintf("failed to marshal the output schema: %s", err)) } return outputSchemaBz, nil diff --git a/modules/service/types/validation.go b/modules/service/types/validation.go index 8869315d..d37ddead 100644 --- a/modules/service/types/validation.go +++ b/modules/service/types/validation.go @@ -6,6 +6,7 @@ import ( "fmt" "regexp" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -32,7 +33,7 @@ var ( // ValidateAuthor verifies whether the parameters are legal func ValidateAuthor(author string) error { if _, err := sdk.AccAddressFromBech32(author); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid author address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid author address (%s)", err) } return nil } @@ -40,7 +41,7 @@ func ValidateAuthor(author string) error { // ValidateServiceName validates the service name func ValidateServiceName(name string) error { if !regexpServiceName.MatchString(name) || len(name) > MaxNameLength { - return sdkerrors.Wrap(ErrInvalidServiceName, name) + return errorsmod.Wrap(ErrInvalidServiceName, name) } return nil } @@ -48,14 +49,14 @@ func ValidateServiceName(name string) error { // ValidateTags verifies whether the given tags are legal func ValidateTags(tags []string) error { if len(tags) > MaxTagsNum { - return sdkerrors.Wrap(ErrInvalidTags, fmt.Sprintf("invalid tags size; got: %d, max: %d", len(tags), MaxTagsNum)) + return errorsmod.Wrap(ErrInvalidTags, fmt.Sprintf("invalid tags size; got: %d, max: %d", len(tags), MaxTagsNum)) } if HasDuplicate(tags) { - return sdkerrors.Wrap(ErrInvalidTags, "duplicate tag") + return errorsmod.Wrap(ErrInvalidTags, "duplicate tag") } for i, tag := range tags { if !regexpTag.MatchString(tag) { - return sdkerrors.Wrapf(ErrInvalidTags, "tag [%d] is invalid, must match regexp: %s", i, regexpTag.String()) + return errorsmod.Wrapf(ErrInvalidTags, "tag [%d] is invalid, must match regexp: %s", i, regexpTag.String()) } } return nil @@ -64,7 +65,7 @@ func ValidateTags(tags []string) error { // ValidateServiceDescription verifies whether the parameters are legal func ValidateServiceDescription(svcDescription string) error { if len(svcDescription) > MaxDescriptionLength { - return sdkerrors.Wrap(ErrInvalidDescription, fmt.Sprintf("invalid service description length; got: %d, max: %d", len(svcDescription), MaxDescriptionLength)) + return errorsmod.Wrap(ErrInvalidDescription, fmt.Sprintf("invalid service description length; got: %d, max: %d", len(svcDescription), MaxDescriptionLength)) } return nil } @@ -72,7 +73,7 @@ func ValidateServiceDescription(svcDescription string) error { // ValidateAuthorDescription verifies whether the parameters are legal func ValidateAuthorDescription(authorDescription string) error { if len(authorDescription) > MaxDescriptionLength { - return sdkerrors.Wrap(ErrInvalidDescription, fmt.Sprintf("invalid author description length; got: %d, max: %d", len(authorDescription), MaxDescriptionLength)) + return errorsmod.Wrap(ErrInvalidDescription, fmt.Sprintf("invalid author description length; got: %d, max: %d", len(authorDescription), MaxDescriptionLength)) } return nil } @@ -80,7 +81,7 @@ func ValidateAuthorDescription(authorDescription string) error { // ValidateProvider verifies whether the parameters are legal func ValidateProvider(provider string) error { if _, err := sdk.AccAddressFromBech32(provider); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid provider address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid provider address (%s)", err) } return nil } @@ -88,7 +89,7 @@ func ValidateProvider(provider string) error { // ValidateOwner verifies whether the parameters are legal func ValidateOwner(owner string) error { if _, err := sdk.AccAddressFromBech32(owner); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } return nil } @@ -96,10 +97,10 @@ func ValidateOwner(owner string) error { // ValidateServiceDeposit verifies whether the parameters are legal func ValidateServiceDeposit(deposit sdk.Coins) error { if !deposit.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "invalid deposit") + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, "invalid deposit") } if deposit.IsAnyNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "invalid deposit") + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, "invalid deposit") } return nil } @@ -120,7 +121,7 @@ func ValidatePricing(pricing string) error { // ValidateQoS verifies whether the parameters are legal func ValidateQoS(qos uint64) error { if qos == 0 { - return sdkerrors.Wrap(ErrInvalidQoS, "qos must be greater than 0") + return errorsmod.Wrap(ErrInvalidQoS, "qos must be greater than 0") } return nil } @@ -128,7 +129,7 @@ func ValidateQoS(qos uint64) error { // ValidateOptions verifies whether the parameters are legal func ValidateOptions(options string) error { if !json.Valid([]byte(options)) { - return sdkerrors.Wrap(ErrInvalidOptions, "options is not valid JSON") + return errorsmod.Wrap(ErrInvalidOptions, "options is not valid JSON") } return nil } @@ -136,7 +137,7 @@ func ValidateOptions(options string) error { // ValidateWithdrawAddress verifies whether the parameters are legal func ValidateWithdrawAddress(withdrawAddress string) error { if _, err := sdk.AccAddressFromBech32(withdrawAddress); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid withdrawal address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid withdrawal address (%s)", err) } return nil } @@ -167,14 +168,14 @@ func ValidateRequest( return err } if timeout <= 0 { - return sdkerrors.Wrapf(ErrInvalidTimeout, "timeout [%d] must be greater than 0", timeout) + return errorsmod.Wrapf(ErrInvalidTimeout, "timeout [%d] must be greater than 0", timeout) } if repeated { if repeatedFrequency > 0 && repeatedFrequency < uint64(timeout) { - return sdkerrors.Wrapf(ErrInvalidRepeatedFreq, "repeated frequency [%d] must not be less than timeout [%d]", repeatedFrequency, timeout) + return errorsmod.Wrapf(ErrInvalidRepeatedFreq, "repeated frequency [%d] must not be less than timeout [%d]", repeatedFrequency, timeout) } if repeatedTotal < -1 || repeatedTotal == 0 { - return sdkerrors.Wrapf(ErrInvalidRepeatedTotal, "repeated total number [%d] must be greater than 0 or equal to -1", repeatedTotal) + return errorsmod.Wrapf(ErrInvalidRepeatedTotal, "repeated total number [%d] must be greater than 0 or equal to -1", repeatedTotal) } } return nil @@ -197,13 +198,13 @@ func ValidateRequestContextUpdating( } } if timeout < 0 { - return sdkerrors.Wrapf(ErrInvalidTimeout, "timeout must not be less than 0: %d", timeout) + return errorsmod.Wrapf(ErrInvalidTimeout, "timeout must not be less than 0: %d", timeout) } if timeout != 0 && repeatedFrequency != 0 && repeatedFrequency < uint64(timeout) { - return sdkerrors.Wrapf(ErrInvalidRepeatedFreq, "frequency [%d] must not be less than timeout [%d]", repeatedFrequency, timeout) + return errorsmod.Wrapf(ErrInvalidRepeatedFreq, "frequency [%d] must not be less than timeout [%d]", repeatedFrequency, timeout) } if repeatedTotal < -1 { - return sdkerrors.Wrapf(ErrInvalidRepeatedFreq, "repeated total number must not be less than -1: %d", repeatedTotal) + return errorsmod.Wrapf(ErrInvalidRepeatedFreq, "repeated total number must not be less than -1: %d", repeatedTotal) } return nil } @@ -211,7 +212,7 @@ func ValidateRequestContextUpdating( // ValidateConsumer verifies whether the parameters are legal func ValidateConsumer(consumer string) error { if _, err := sdk.AccAddressFromBech32(consumer); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid consumer address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid consumer address (%s)", err) } return nil } @@ -219,10 +220,10 @@ func ValidateConsumer(consumer string) error { // ValidateProviders verifies whether the parameters are legal func ValidateProviders(providers []sdk.AccAddress) error { if len(providers) == 0 { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "providers missing") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "providers missing") } if len(providers) > MaxProvidersNum { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "total number of the providers must not be greater than %d", MaxProvidersNum) + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "total number of the providers must not be greater than %d", MaxProvidersNum) } if err := checkDuplicateProviders(providers); err != nil { return err @@ -233,7 +234,7 @@ func ValidateProviders(providers []sdk.AccAddress) error { // ValidateProvidersCanEmpty verifies whether the parameters are legal func ValidateProvidersCanEmpty(providers []sdk.AccAddress) error { if len(providers) > MaxProvidersNum { - return sdkerrors.Wrapf(ErrInvalidProviders, "total number of the providers must not be greater than %d", MaxProvidersNum) + return errorsmod.Wrapf(ErrInvalidProviders, "total number of the providers must not be greater than %d", MaxProvidersNum) } if len(providers) > 0 { if err := checkDuplicateProviders(providers); err != nil { @@ -246,7 +247,7 @@ func ValidateProvidersCanEmpty(providers []sdk.AccAddress) error { // ValidateServiceFeeCap verifies whether the parameters are legal func ValidateServiceFeeCap(serviceFeeCap sdk.Coins) error { if !serviceFeeCap.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("invalid service fee cap: %s", serviceFeeCap)) + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("invalid service fee cap: %s", serviceFeeCap)) } return nil } @@ -254,10 +255,10 @@ func ValidateServiceFeeCap(serviceFeeCap sdk.Coins) error { // ValidateRequestID verifies whether the parameters are legal func ValidateRequestID(reqID string) error { if len(reqID) != RequestIDLen { - return sdkerrors.Wrapf(ErrInvalidRequestID, "length of the request ID must be %d", RequestIDLen) + return errorsmod.Wrapf(ErrInvalidRequestID, "length of the request ID must be %d", RequestIDLen) } if _, err := hex.DecodeString(reqID); err != nil { - return sdkerrors.Wrap(ErrInvalidRequestID, "request ID must be a hex encoded string") + return errorsmod.Wrap(ErrInvalidRequestID, "request ID must be a hex encoded string") } return nil } @@ -265,10 +266,10 @@ func ValidateRequestID(reqID string) error { // ValidateContextID verifies whether the parameters are legal func ValidateContextID(contextID string) error { if len(contextID) != ContextIDLen { - return sdkerrors.Wrapf(ErrInvalidRequestContextID, "length of the request context ID must be %d in bytes", ContextIDLen) + return errorsmod.Wrapf(ErrInvalidRequestContextID, "length of the request context ID must be %d in bytes", ContextIDLen) } if _, err := hex.DecodeString(contextID); err != nil { - return sdkerrors.Wrap(ErrInvalidRequestContextID, "request context ID must be a hex encoded string") + return errorsmod.Wrap(ErrInvalidRequestContextID, "request context ID must be a hex encoded string") } return nil } @@ -276,11 +277,11 @@ func ValidateContextID(contextID string) error { // ValidateInput verifies whether the parameters are legal func ValidateInput(input string) error { if len(input) == 0 { - return sdkerrors.Wrap(ErrInvalidRequestInput, "input missing") + return errorsmod.Wrap(ErrInvalidRequestInput, "input missing") } if ValidateRequestInput(input) != nil { - return sdkerrors.Wrap(ErrInvalidRequestInput, "invalid input") + return errorsmod.Wrap(ErrInvalidRequestInput, "invalid input") } return nil @@ -289,15 +290,15 @@ func ValidateInput(input string) error { // ValidateOutput verifies whether the parameters are legal func ValidateOutput(code ResultCode, output string) error { if code == ResultOK && len(output) == 0 { - return sdkerrors.Wrapf(ErrInvalidResponse, "output must be specified when the result code is %v", ResultOK) + return errorsmod.Wrapf(ErrInvalidResponse, "output must be specified when the result code is %v", ResultOK) } if code != ResultOK && len(output) != 0 { - return sdkerrors.Wrapf(ErrInvalidResponse, "output should not be specified when the result code is not %v", ResultOK) + return errorsmod.Wrapf(ErrInvalidResponse, "output should not be specified when the result code is not %v", ResultOK) } if len(output) > 0 && ValidateResponseOutput(output) != nil { - return sdkerrors.Wrap(ErrInvalidResponse, "invalid output") + return errorsmod.Wrap(ErrInvalidResponse, "invalid output") } return nil @@ -311,7 +312,7 @@ func checkDuplicateProviders(providers []sdk.AccAddress) error { } if HasDuplicate(providerArr) { - return sdkerrors.Wrap(ErrInvalidProviders, "there exists duplicate providers") + return errorsmod.Wrap(ErrInvalidProviders, "there exists duplicate providers") } return nil diff --git a/modules/token/client/cli/cli_test.go b/modules/token/client/cli/cli_test.go index b0e5be3a..933a1e8e 100644 --- a/modules/token/client/cli/cli_test.go +++ b/modules/token/client/cli/cli_test.go @@ -98,7 +98,7 @@ func (s *IntegrationTestSuite) TestToken() { //------test GetCmdQueryParams()------------- queryParamsResponse := tokentestutil.QueryParamsExec(s.T(), s.network, clientCtx) - expectedParams := "{\"token_tax_rate\":\"0.400000000000000000\",\"issue_token_base_fee\":{\"denom\":\"stake\",\"amount\":\"60000\"},\"mint_token_fee_ratio\":\"0.100000000000000000\"}" + expectedParams := "{\"token_tax_rate\":\"0.400000000000000000\",\"issue_token_base_fee\":{\"denom\":\"stake\",\"amount\":\"60000\"},\"mint_token_fee_ratio\":\"0.100000000000000000\",\"enable_erc20\":true}" result, _ = json.Marshal(queryParamsResponse) s.Require().Equal(expectedParams, string(result)) @@ -240,4 +240,54 @@ func (s *IntegrationTestSuite) TestToken() { token3 := tokentestutil.QueryTokenExec(s.T(), s.network, clientCtx, tokenSymbol) s.Require().Equal(to, token3.GetOwner()) // --------------------------------------------------------------------------- + + //------test GetCmdSwapToErc20()------------- + // args = []string{ + // fmt.Sprintf("--%s=%s", tokencli.FlagTo, to.String()), + + // fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + // fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + // fmt.Sprintf( + // "--%s=%s", + // flags.FlagFees, + // sdk.NewCoins(sdk.NewCoin(s.network.BondDenom, sdk.NewInt(10))).String(), + // ), + // } + + // txResult = tokentestutil.SwapToERC20Exec( + // s.T(), + // s.network, + // clientCtx, + // from.String(), + // sdk.NewCoins(sdk.NewCoin(s.network.BondDenom, sdk.NewInt(1))).String(), + // args...) + + // TODO assert + // s.Require().Equal(expectedCode, txResult.Code) + // --------------------------------------------------------------------------- + + //------test GetCmdSwapFromErc20()------------- + // args = []string{ + // fmt.Sprintf("--%s=%s", tokencli.FlagTo, to.String()), + + // fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + // fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + // fmt.Sprintf( + // "--%s=%s", + // flags.FlagFees, + // sdk.NewCoins(sdk.NewCoin(s.network.BondDenom, sdk.NewInt(10))).String(), + // ), + // } + + // txResult = tokentestutil.SwapFromERC20Exec( + // s.T(), + // s.network, + // clientCtx, + // from.String(), + // sdk.NewCoins(sdk.NewCoin(s.network.BondDenom, sdk.NewInt(1))).String(), + // args...) + + // TODO assert + // s.Require().Equal(expectedCode, txResult.Code) + // --------------------------------------------------------------------------- } diff --git a/modules/token/client/cli/flags.go b/modules/token/client/cli/flags.go index 60d1f042..06d96734 100644 --- a/modules/token/client/cli/flags.go +++ b/modules/token/client/cli/flags.go @@ -25,6 +25,8 @@ var ( FsTransferTokenOwner = flag.NewFlagSet("", flag.ContinueOnError) FsMintToken = flag.NewFlagSet("", flag.ContinueOnError) FsSwapFeeToken = flag.NewFlagSet("", flag.ContinueOnError) + FsSwapToErc20 = flag.NewFlagSet("", flag.ContinueOnError) + FsSwapFromErc20 = flag.NewFlagSet("", flag.ContinueOnError) ) func init() { @@ -42,5 +44,7 @@ func init() { FsTransferTokenOwner.String(FlagTo, "", "The new owner") FsMintToken.String(FlagTo, "", "Address to which the token is to be minted") - FsSwapFeeToken.String(FlagTo, "", "Address to which the token is to be receiver") + FsSwapFeeToken.String(FlagTo, "", "Address to which the token is to be received") + FsSwapToErc20.String(FlagTo, "", "Address to which the token is to be received") + FsSwapFromErc20.String(FlagTo, "", "Address to which the token is to be received") } diff --git a/modules/token/client/cli/query.go b/modules/token/client/cli/query.go index 71f0d397..35de492b 100644 --- a/modules/token/client/cli/query.go +++ b/modules/token/client/cli/query.go @@ -29,6 +29,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryFee(), GetCmdQueryTotalBurn(), GetCmdQueryParams(), + GetCmdQueryBalances(), ) return queryCmd @@ -43,7 +44,6 @@ func GetCmdQueryToken() *cobra.Command { Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { return err } @@ -57,7 +57,6 @@ func GetCmdQueryToken() *cobra.Command { res, err := queryClient.Token(context.Background(), &v1.QueryTokenRequest{ Denom: args[0], }) - if err != nil { return err } @@ -212,3 +211,32 @@ func GetCmdQueryTotalBurn() *cobra.Command { return cmd } + +// GetCmdQueryBalances return all the balances of an owner in special denom +func GetCmdQueryBalances() *cobra.Command { + cmd := &cobra.Command{ + Use: "balances [addr] [denom]", + Args: cobra.ExactArgs(2), + Long: "Query all the balances of an owner in special denom.", + Example: fmt.Sprintf("$ %s query token balances ", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + res, err := queryClient.Balances(context.Background(), &v1.QueryBalancesRequest{ + Address: args[0], + Denom: args[1], + }) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/modules/token/client/cli/tx.go b/modules/token/client/cli/tx.go index 74d8f038..20eb8691 100644 --- a/modules/token/client/cli/tx.go +++ b/modules/token/client/cli/tx.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + "github.com/ethereum/go-ethereum/common" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -33,6 +34,8 @@ func NewTxCmd() *cobra.Command { GetCmdBurnToken(), GetCmdTransferTokenOwner(), GetCmdSwapFeeToken(), + GetCmdSwapToErc20(), + GetCmdSwapFromErc20(), ) return txCmd @@ -108,7 +111,7 @@ func GetCmdIssueToken() *cobra.Command { return err } - var prompt = "The token issuance transaction will consume extra fee" + prompt := "The token issuance transaction will consume extra fee" generateOnly, err := cmd.Flags().GetBool(flags.FlagGenerateOnly) if err != nil { @@ -235,16 +238,16 @@ func GetCmdMintToken() *cobra.Command { } msg := &v1.MsgMintToken{ - Coin: coin, - To: addr, - Owner: owner, + Coin: coin, + Receiver: addr, + Owner: owner, } if err := msg.ValidateBasic(); err != nil { return err } - var prompt = "The token minting transaction will consume extra fee" + prompt := "The token minting transaction will consume extra fee" generateOnly, err := cmd.Flags().GetBool(flags.FlagGenerateOnly) if err != nil { @@ -274,6 +277,12 @@ func GetCmdMintToken() *cobra.Command { return cmd } +// GetCmdBurnToken returns the command to burn tokens. +// +// This function handles the burning of tokens based on the provided coin input. +// It constructs and validates a message to burn the specified tokens. +// Returns an error if the operation encounters any issues. +// Returns a *cobra.Command. func GetCmdBurnToken() *cobra.Command { cmd := &cobra.Command{ Use: "burn [coin]", @@ -398,9 +407,9 @@ func GetCmdSwapFeeToken() *cobra.Command { } msg := &v1.MsgSwapFeeToken{ - FeePaid: coin, - Recipient: toAddr, - Sender: sender, + FeePaid: coin, + Receiver: toAddr, + Sender: sender, } if err := msg.ValidateBasic(); err != nil { @@ -415,3 +424,128 @@ func GetCmdSwapFeeToken() *cobra.Command { flags.AddTxFlagsToCmd(cmd) return cmd } + +// GetCmdSwapToErc20 implements the swap-to-erc20 command +func GetCmdSwapToErc20() *cobra.Command { + cmd := &cobra.Command{ + Use: "swap-to-erc20", + Long: "Swap native token to the corresponding ERC20 at 1:1.", + Example: fmt.Sprintf( + "$ %s tx token swap-to-erc20 [paid_amount]"+ + "--to=\"0x0eeb8ec40c6705b669469346ff8f9ce5cad57ed5\" "+ + "--from= "+ + "--chain-id= "+ + "--fees=", + version.AppName, + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + paidAmount, token, err := parseMainCoin(clientCtx, args[0]) + if err != nil { + return err + } + if len(token.GetContract()) <= 0 { + return fmt.Errorf("corresponding erc20 contract of %s does not exist", paidAmount.Denom) + } + + receiver, err := cmd.Flags().GetString(FlagTo) + if err != nil { + return err + } + + from := clientCtx.GetFromAddress() + if len(receiver) <= 0 { + // set default receiver + receiver = common.BytesToAddress(from.Bytes()).Hex() + } + + msg := &v1.MsgSwapToERC20{ + Amount: paidAmount, + Sender: from.String(), + Receiver: receiver, + } + + if err := msg.ValidateBasic(); err != nil { + return err + } + + prompt := fmt.Sprintf("Swapping native token to ERC20, sender: %s, receiver: %s, contract: %s, amount: %s", from, receiver, token.GetContract(), paidAmount) + + fmt.Println(prompt) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().AddFlagSet(FsSwapToErc20) + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +// GetCmdSwapFromErc20 implements the swap-from-erc20 command +func GetCmdSwapFromErc20() *cobra.Command { + cmd := &cobra.Command{ + Use: "swap-from-erc20", + Long: "Swap native token from the corresponding ERC20 at 1:1.", + Example: fmt.Sprintf( + "$ %s tx token swap-from-erc20 [wanted_amount]"+ + "--to=\"iaaeeb8ec40c6705b669469346ff8f9ce5cad57ed5\" "+ + "--from= "+ + "--chain-id= "+ + "--fees=", + version.AppName, + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + from := clientCtx.GetFromAddress().String() + wantedAmount, token, err := parseMainCoin(clientCtx, args[0]) + if err != nil { + return err + } + if len(token.GetContract()) <= 0 { + return fmt.Errorf("corresponding erc20 contract of %s does not exist", wantedAmount.Denom) + } + + receiver, err := cmd.Flags().GetString(FlagTo) + if err != nil { + return err + } + if len(receiver) <= 0 { + // set default receiver + receiver = from + } + + msg := &v1.MsgSwapFromERC20{ + WantedAmount: wantedAmount, + Sender: from, + Receiver: receiver, + } + + if err := msg.ValidateBasic(); err != nil { + return err + } + + prompt := fmt.Sprintf("Swapping native token from ERC20, sender: %s, receiver: %s, contract: %s, amount: %s", from, receiver, token.GetContract(), wantedAmount) + + fmt.Println(prompt) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().AddFlagSet(FsSwapFromErc20) + flags.AddTxFlagsToCmd(cmd) + + return cmd +} \ No newline at end of file diff --git a/modules/token/client/testutil/grpc_query_test.go b/modules/token/client/testutil/grpc_query_test.go index cb707187..c11fc3c5 100644 --- a/modules/token/client/testutil/grpc_query_test.go +++ b/modules/token/client/testutil/grpc_query_test.go @@ -123,7 +123,7 @@ func (s *IntegrationTestSuite) TestToken() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(resp, respType)) paramsResp := respType.(*v1.QueryParamsResponse) s.Require().NoError(err) - expectedParams := "{\"token_tax_rate\":\"0.400000000000000000\",\"issue_token_base_fee\":{\"denom\":\"stake\",\"amount\":\"60000\"},\"mint_token_fee_ratio\":\"0.100000000000000000\"}" + expectedParams := "{\"token_tax_rate\":\"0.400000000000000000\",\"issue_token_base_fee\":{\"denom\":\"stake\",\"amount\":\"60000\"},\"mint_token_fee_ratio\":\"0.100000000000000000\",\"enable_erc20\":true}" result, _ = json.Marshal(paramsResp.Params) s.Require().Equal(expectedParams, string(result)) } diff --git a/modules/token/client/testutil/test_helpers.go b/modules/token/client/testutil/test_helpers.go index 7fad5da6..e32d3de0 100644 --- a/modules/token/client/testutil/test_helpers.go +++ b/modules/token/client/testutil/test_helpers.go @@ -96,6 +96,38 @@ func TransferTokenOwnerExec(t *testing.T, return network.ExecTxCmdWithResult(t, clientCtx, tokencli.GetCmdTransferTokenOwner(), args) } +func SwapToERC20Exec(t *testing.T, + network simapp.Network, + clientCtx client.Context, + from string, + coinStr string, + extraArgs ...string, +) *simapp.ResponseTx { + args := []string{ + coinStr, + fmt.Sprintf("--%s=%s", flags.FlagFrom, from), + } + args = append(args, extraArgs...) + + return network.ExecTxCmdWithResult(t, clientCtx, tokencli.GetCmdSwapToErc20(), args) +} + +func SwapFromERC20Exec(t *testing.T, + network simapp.Network, + clientCtx client.Context, + from string, + coinStr string, + extraArgs ...string, +) *simapp.ResponseTx { + args := []string{ + coinStr, + fmt.Sprintf("--%s=%s", flags.FlagFrom, from), + } + args = append(args, extraArgs...) + + return network.ExecTxCmdWithResult(t, clientCtx, tokencli.GetCmdSwapFromErc20(), args) +} + func QueryTokenExec(t *testing.T, network simapp.Network, clientCtx client.Context, diff --git a/modules/token/depinject.go b/modules/token/depinject.go index 00f2da08..5e8492c0 100644 --- a/modules/token/depinject.go +++ b/modules/token/depinject.go @@ -36,6 +36,7 @@ func (am AppModule) IsOnePerModuleType() {} // IsAppModule implements the appmodule.AppModule interface. func (am AppModule) IsAppModule() {} +// TokenInputs is the input of the Token module type TokenInputs struct { depinject.In @@ -45,11 +46,14 @@ type TokenInputs struct { AccountKeeper types.AccountKeeper BankKeeper types.BankKeeper + EVMKeeper types.EVMKeeper + ICS20Keeper types.ICS20Keeper // LegacySubspace is used solely for migration of x/params managed parameters LegacySubspace exported.Subspace `optional:"true"` } +// TokenOutputs is the output of the Token module type TokenOutputs struct { depinject.Out @@ -57,6 +61,9 @@ type TokenOutputs struct { Module appmodule.AppModule } +// ProvideModule provides a module for the token with the given inputs and returns the token keeper and module. +// +// Takes TokenInputs as input parameters and returns TokenOutputs. func ProvideModule(in TokenInputs) TokenOutputs { // default to governance authority if not provided authority := authtypes.NewModuleAddress(govtypes.ModuleName) @@ -68,6 +75,9 @@ func ProvideModule(in TokenInputs) TokenOutputs { in.Cdc, in.Key, in.BankKeeper, + in.AccountKeeper, + in.EVMKeeper, + in.ICS20Keeper, in.Config.FeeCollectorName, authority.String(), ) diff --git a/modules/token/genesis.go b/modules/token/genesis.go index f34ecad2..8459ccd0 100644 --- a/modules/token/genesis.go +++ b/modules/token/genesis.go @@ -21,7 +21,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data v1.GenesisState) { // init tokens for _, token := range data.Tokens { - if err := k.AddToken(ctx, token); err != nil { + if err := k.AddToken(ctx, token, false); err != nil { panic(err.Error()) } } @@ -34,7 +34,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data v1.GenesisState) { if !k.HasSymbol(ctx, data.Params.IssueTokenBaseFee.Denom) { panic(fmt.Sprintf("Token %s does not exist", data.Params.IssueTokenBaseFee.Denom)) } - } // ExportGenesis outputs the genesis state diff --git a/modules/token/handler.go b/modules/token/handler.go index 07cd24af..a9f916e9 100644 --- a/modules/token/handler.go +++ b/modules/token/handler.go @@ -1,6 +1,7 @@ package token import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -41,7 +42,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized nft message type: %T", msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized nft message type: %T", msg) } } } diff --git a/modules/token/handler_test.go b/modules/token/handler_test.go index 20c012e7..1cfe64cf 100644 --- a/modules/token/handler_test.go +++ b/modules/token/handler_test.go @@ -65,7 +65,7 @@ func (suite *HandlerSuite) SetupTest() { } func (suite *HandlerSuite) issueToken(token v1.Token) { - err := suite.keeper.AddToken(suite.ctx, token) + err := suite.keeper.AddToken(suite.ctx, token, true) suite.NoError(err) mintCoins := sdk.NewCoins( diff --git a/modules/token/keeper/ante.go b/modules/token/keeper/ante.go index a8b81256..f4c92a02 100644 --- a/modules/token/keeper/ante.go +++ b/modules/token/keeper/ante.go @@ -1,6 +1,7 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -30,7 +31,7 @@ func (dtf ValidateTokenFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu case *v1.MsgIssueToken: fee, err := dtf.k.GetTokenIssueFee(ctx, msg.Symbol) if err != nil { - return ctx, sdkerrors.Wrap(types.ErrInvalidBaseFee, err.Error()) + return ctx, errorsmod.Wrap(types.ErrInvalidBaseFee, err.Error()) } if fe, ok := feeMap[msg.Owner]; ok { @@ -46,7 +47,7 @@ func (dtf ValidateTokenFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu fee, err := dtf.k.GetTokenMintFee(ctx, symbol) if err != nil { - return ctx, sdkerrors.Wrap(types.ErrInvalidBaseFee, err.Error()) + return ctx, errorsmod.Wrap(types.ErrInvalidBaseFee, err.Error()) } if fe, ok := feeMap[msg.Owner]; ok { @@ -61,7 +62,7 @@ func (dtf ValidateTokenFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu owner, _ := sdk.AccAddressFromBech32(addr) balance := dtf.bk.GetBalance(ctx, owner, fee.Denom) if balance.IsLT(fee) { - return ctx, sdkerrors.Wrapf( + return ctx, errorsmod.Wrapf( sdkerrors.ErrInsufficientFunds, "insufficient coins for token fee; %s < %s", balance, fee, ) } diff --git a/modules/token/keeper/erc20.go b/modules/token/keeper/erc20.go new file mode 100644 index 00000000..31cd0cf2 --- /dev/null +++ b/modules/token/keeper/erc20.go @@ -0,0 +1,421 @@ +package keeper + +import ( + "math/big" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + + "github.com/irisnet/irismod/contracts" + "github.com/irisnet/irismod/modules/token/types" + v1 "github.com/irisnet/irismod/modules/token/types/v1" +) + +// DeployERC20 deploys an ERC20 token contract. +// +// Parameters: +// - ctx: the context +// - name: the name of the token +// - symbol: the symbol of the token +// - minUnit: the symbol of the minUnit +// - scale: the scale of the token +// +// Returns: +// - Address: the contract address. +// - error: error if any. +func (k Keeper) DeployERC20( + ctx sdk.Context, + name string, + symbol string, + minUnit string, + scale uint8, +) (common.Address, error) { + token, err := k.buildERC20Token(ctx, name, symbol, minUnit, uint32(scale)) + if err != nil { + return common.Address{}, err + } + + if len(token.Contract) > 0 { + return common.Address{}, errorsmod.Wrapf(types.ErrERC20AlreadyExists, "token: %s already deployed erc20 contract: %s", token.Symbol, token.Contract) + } + + params := k.GetParams(ctx) + if !params.EnableErc20 { + return common.Address{}, errorsmod.Wrapf(types.ErrERC20Disabled, "erc20 is disabled") + } + + if len(params.Beacon) == 0 { + return common.Address{}, errorsmod.Wrapf(types.ErrBeaconNotSet, "beacon not set") + } + + deployer := k.getModuleEthAddress(ctx) + + initArgs, err := contracts.ERC20TokenContract.ABI.Pack( + contracts.MethodInitialize, + name, + symbol, + scale, + deployer, + ) + if err != nil { + return common.Address{}, err + } + + contractArgs, err := contracts.TokenProxyContract.ABI.Pack( + "", + common.HexToAddress(params.Beacon), + initArgs, + ) + if err != nil { + return common.Address{}, errorsmod.Wrapf(types.ErrABIPack, "erc20 metadata is invalid %s: %s", name, err.Error()) + } + + data := make([]byte, len(contracts.TokenProxyContract.Bin)+len(contractArgs)) + copy(data[:len(contracts.TokenProxyContract.Bin)], contracts.TokenProxyContract.Bin) + copy(data[len(contracts.TokenProxyContract.Bin):], contractArgs) + + nonce, err := k.accountKeeper.GetSequence(ctx, sdk.AccAddress(deployer.Bytes())) + if err != nil { + return common.Address{}, err + } + contractAddr := crypto.CreateAddress(deployer, nonce) + result, err := k.CallEVMWithData(ctx, deployer, nil, data, true) + if err != nil { + return common.Address{}, errorsmod.Wrapf(err, "failed to deploy contract for token %s", name) + } + if result.Failed() { + return common.Address{}, errorsmod.Wrapf(types.ErrVMExecution, "failed to deploy contract for %s, reason: %s", name, result.Revert()) + } + + token.Contract = contractAddr.String() + k.upsertToken(ctx, *token) + + ctx.EventManager().EmitTypedEvent(&v1.EventDeployERC20{ + Symbol: symbol, + Name: name, + Scale: uint32(scale), + MinUnit: minUnit, + Contract: contractAddr.String(), + }) + return contractAddr, nil +} + +// SwapFromERC20 executes a swap from an ERC20 token to its native counterpart +// +// Parameters: +// +// ctx - the context in which the swap is executed +// sender - the address of the sender +// receiver - the address of the receiver +// wantedAmount - the amount of the token to be swapped out +// +// Return type: error +func (k Keeper) SwapFromERC20( + ctx sdk.Context, + sender common.Address, + receiver sdk.AccAddress, + wantedAmount sdk.Coin, +) error { + if !k.ERC20Enabled(ctx) { + return types.ErrERC20Disabled + } + + token, err := k.getTokenByMinUnit(ctx, wantedAmount.Denom) + if err != nil { + return err + } + if len(token.Contract) == 0 { + return errorsmod.Wrapf(types.ErrERC20NotDeployed, "The token %s is not bound to the corresponding erc20 token", wantedAmount.Denom) + } + + contract := common.HexToAddress(token.Contract) + if err := k.BurnERC20(ctx, contract, sender, wantedAmount.Amount.BigInt()); err != nil { + return err + } + + mintedCoins := sdk.NewCoins(wantedAmount) + if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, mintedCoins); err != nil { + return err + } + + if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, receiver, mintedCoins); err != nil { + return err + } + + ctx.EventManager().EmitTypedEvent(&v1.EventSwapFromERC20{ + FromContract: contract.String(), + WantedAmount: &wantedAmount, + Sender: sender.String(), + Receiver: receiver.String(), + }) + return nil +} + +// SwapToERC20 executes a swap from a native token to its ERC20 token counterpart +// +// Parameters: +// - ctx: the context +// - sender: the sender of the amount +// - receiver: the receiver of the erc20 token +// - amount: the amount to be swapped +// +// Returns: +// - error: error if any. +func (k Keeper) SwapToERC20( + ctx sdk.Context, + sender sdk.AccAddress, + receiver common.Address, + amount sdk.Coin, +) error { + if !k.ERC20Enabled(ctx) { + return types.ErrERC20Disabled + } + + receiverAcc := k.accountKeeper.GetAccount(ctx, sdk.AccAddress(receiver.Bytes())) + if receiverAcc != nil { + if !k.evmKeeper.SupportedKey(receiverAcc.GetPubKey()) { + return errorsmod.Wrapf(types.ErrUnsupportedKey, "key %s", receiverAcc.GetPubKey()) + } + } + + token, err := k.getTokenByMinUnit(ctx, amount.Denom) + if err != nil { + return err + } + if len(token.Contract) == 0 { + return errorsmod.Wrapf(types.ErrERC20NotDeployed, "token: %s is not bound to the corresponding erc20 token", amount.Denom) + } + contract := common.HexToAddress(token.Contract) + + amt := sdk.NewCoins(amount) + if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, amt); err != nil { + return err + } + + if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, amt); err != nil { + return err + } + + if err := k.MintERC20(ctx, contract, receiver, amount.Amount.BigInt()); err != nil { + return err + } + + ctx.EventManager().EmitTypedEvent(&v1.EventSwapToERC20{ + Amount: amount, + Sender: sender.String(), + Receiver: receiver.String(), + ToContract: token.Contract, + }) + return nil +} + +// MintERC20 mints ERC20 tokens to an account. +// +// Parameters: +// - ctx: the sdk.Context for the function +// - contract: the address of the contract +// - to: the address of the receiver +// - amount: the amount to mint +// +// Returns: +// - err : error if any +func (k Keeper) MintERC20( + ctx sdk.Context, + contract, to common.Address, + amount *big.Int, +) error { + balanceBefore, err := k.BalanceOf(ctx, contract, to) + if err != nil { + return err + } + + abi := contracts.ERC20TokenContract.ABI + res, err := k.CallEVM(ctx, abi, k.getModuleEthAddress(ctx), contract, true, contracts.MethodMint, to, amount) + if err != nil { + return err + } + + if res.Failed() { + return errorsmod.Wrapf( + types.ErrVMExecution, "failed to mint contract: %s, reason: %s", + contract.String(), + res.Revert(), + ) + } + + balanceAfter, err := k.BalanceOf(ctx, contract, to) + if err != nil { + return err + } + expectBalance := big.NewInt(0).Add(balanceBefore, amount) + if r := expectBalance.Cmp(balanceAfter); r != 0 { + return errorsmod.Wrapf( + types.ErrVMExecution, "failed to mint token correctly, expected after-mint amount is incorrect: %s, expected %d, actual %d", + contract.String(), + expectBalance.Int64(), + balanceAfter.Int64(), + ) + } + return nil +} + +// BurnERC20 burns a specific amount of ERC20 tokens from a given contract and address. +// +// Parameters: +// - ctx: the context in which the transaction is executed +// - contract: the contract address of the ERC20 token +// - from: the address from which the tokens are burned +// - amount: the amount of tokens to burn +// +// Returns an error. +func (k Keeper) BurnERC20( + ctx sdk.Context, + contract, from common.Address, + amount *big.Int, +) error { + balanceBefore, err := k.BalanceOf(ctx, contract, from) + if err != nil { + return err + } + + if r := balanceBefore.Cmp(amount); r < 0 { + return errorsmod.Wrapf( + sdkerrors.ErrInsufficientFunds, + "balance: %d, swap: %d", + balanceBefore.Int64(), + amount, + ) + } + + abi := contracts.ERC20TokenContract.ABI + res, err := k.CallEVM(ctx, abi, k.getModuleEthAddress(ctx), contract, true, contracts.MethodBurn, from, amount) + if err != nil { + return err + } + + if res.Failed() { + return errorsmod.Wrapf(types.ErrVMExecution, "failed to burn %d", amount) + } + + balanceAfter, err := k.BalanceOf(ctx, contract, from) + if err != nil { + return err + } + expectBalance := big.NewInt(0).Sub(balanceBefore, amount) + if r := expectBalance.Cmp(balanceAfter); r != 0 { + return errorsmod.Wrapf( + types.ErrVMExecution, "failed to burn token correctly, expected after-burn amount is incorrect: %s, expected %d, actual %d", + contract.String(), + expectBalance.Int64(), + balanceAfter.Int64(), + ) + } + return nil +} + +// UpgradeERC20 upgrades the ERC20 contract to a new implementation. +// +// Parameters: +// - ctx: the SDK context. +// - implementation: the address of the new implementation contract. +// +// Returns: +// - error: an error if the upgrade fails. +func (k Keeper) UpgradeERC20( + ctx sdk.Context, + implementation common.Address, +) error { + params := k.GetParams(ctx) + if !params.EnableErc20 { + return errorsmod.Wrapf(types.ErrERC20Disabled, "erc20 is disabled") + } + + if len(params.Beacon) == 0 { + return errorsmod.Wrapf(types.ErrBeaconNotSet, "beacon not set") + } + + beacon := common.HexToAddress(params.Beacon) + abi := contracts.BeaconContract.ABI + res, err := k.CallEVM(ctx, abi, k.getModuleEthAddress(ctx), beacon, true, contracts.MethodUpgradeTo, implementation) + if err != nil { + return err + } + if res.Failed() { + return errorsmod.Wrapf( + types.ErrVMExecution, "failed to upgrade contract reason: %s", + res.Revert(), + ) + } + return nil +} + +// BalanceOf retrieves the balance of a specific account in the contract. +// +// Parameters: +// - ctx: the sdk.Context for the function +// - contract: the address of the contract +// - account: the address of the account to retrieve the balance for +// +// Returns: +// - *big.Int: the balance of the specified account +func (k Keeper) BalanceOf( + ctx sdk.Context, + contract, account common.Address, +) (*big.Int, error) { + abi := contracts.ERC20TokenContract.ABI + res, err := k.CallEVM(ctx, abi, k.getModuleEthAddress(ctx), contract, false, contracts.MethodBalanceOf, account) + if err != nil { + return nil, err + } + + unpacked, err := abi.Unpack(contracts.MethodBalanceOf, res.Ret) + if err != nil || len(unpacked) == 0 { + return nil, err + } + + balance, ok := unpacked[0].(*big.Int) + if !ok { + return nil, err + } + + return balance, nil +} + +func (k Keeper) getModuleEthAddress(ctx sdk.Context) common.Address { + moduleAccount := k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) + return common.BytesToAddress(moduleAccount.GetAddress().Bytes()) +} + +func (k Keeper) buildERC20Token( + ctx sdk.Context, + name string, + symbol string, + minUnit string, + scale uint32, +) (*v1.Token, error) { + if !k.HasMinUint(ctx, minUnit) { + if k.HasSymbol(ctx, symbol) { + return nil, errorsmod.Wrapf(types.ErrSymbolAlreadyExists, "symbol already exists: %s", symbol) + } + if !k.ics20Keeper.HasTrace(ctx, minUnit) { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "token: %s does not exist", minUnit) + } + return &v1.Token{ + Symbol: symbol, + Name: name, + Scale: scale, + MinUnit: minUnit, + Mintable: true, + Owner: k.accountKeeper.GetModuleAddress(types.ModuleName).String(), + }, nil + } + + token, err := k.getTokenByMinUnit(ctx, minUnit) + if err != nil { + return nil, err + } + return &token, nil +} diff --git a/modules/token/keeper/erc20_test.go b/modules/token/keeper/erc20_test.go new file mode 100644 index 00000000..2154f32c --- /dev/null +++ b/modules/token/keeper/erc20_test.go @@ -0,0 +1,109 @@ +package keeper_test + +import ( + "math/big" + + "github.com/cometbft/cometbft/crypto/tmhash" + "github.com/ethereum/go-ethereum/common" + + sdk "github.com/cosmos/cosmos-sdk/types" + + v1 "github.com/irisnet/irismod/modules/token/types/v1" +) + +func (suite *KeeperTestSuite) TestDeployERC20() { + token := v1.NewToken("btc", "Bitcoin Network", "satoshi", 18, 21000000, 21000000, false, owner) + + err := suite.keeper.IssueToken( + suite.ctx, token.Symbol, token.Name, + token.MinUnit, token.Scale, token.InitialSupply, + token.MaxSupply, token.Mintable, token.GetOwner(), + ) + suite.NoError(err) + + hash, err := suite.keeper.DeployERC20(suite.ctx, token.Name, token.Symbol, token.MinUnit, uint8(token.Scale)) + suite.NoError(err) + token.Contract = hash.Hex() + + actual, err := suite.keeper.GetToken(suite.ctx, token.Symbol) + suite.NoError(err) + + suite.EqualValues(&token, actual.(*v1.Token)) +} + +func (suite *KeeperTestSuite) TestSwapFromERC20() { + token := v1.NewToken("btc", "Bitcoin Network", "satoshi", 18, 21000000, 21000000, false, owner) + + err := suite.keeper.IssueToken( + suite.ctx, token.Symbol, token.Name, + token.MinUnit, token.Scale, token.InitialSupply, + token.MaxSupply, token.Mintable, token.GetOwner(), + ) + suite.NoError(err) + + contract, err := suite.keeper.DeployERC20(suite.ctx, token.Name, token.Symbol, token.MinUnit, uint8(token.Scale)) + suite.NoError(err) + token.Contract = contract.Hex() + + actual, err := suite.keeper.GetToken(suite.ctx, token.Symbol) + suite.NoError(err) + + suite.EqualValues(&token, actual.(*v1.Token)) + + cosmosAddr := sdk.AccAddress(tmhash.SumTruncated([]byte("TestSwapFromERC20"))) + amount := big.NewInt(2e18) + evmAddr := common.BytesToAddress(cosmosAddr.Bytes()) + + suite.Run("mint erc20", func() { + err = suite.keeper.MintERC20(suite.ctx, contract, evmAddr, amount) + suite.NoError(err) + }) + + suite.Run("swap from erc20", func() { + wantedAmount := sdk.NewCoin(token.MinUnit, sdk.NewInt(1e18)) + + err = suite.keeper.SwapFromERC20(suite.ctx, evmAddr, cosmosAddr, wantedAmount) + suite.NoError(err) + + actual := suite.bk.GetBalance(suite.ctx, cosmosAddr, token.MinUnit) + suite.True(wantedAmount.Equal(actual), "SwapFromERC20 failed: %s != %s", wantedAmount.String(), actual.String()) + + balance, err := suite.keeper.BalanceOf(suite.ctx, contract, evmAddr) + suite.NoError(err) + + expect := big.NewInt(0).Sub(amount, wantedAmount.Amount.BigInt()) + suite.True(expect.Cmp(balance) == 0, "SwapFromERC20 failed balance: %s != %s", expect.String(), balance.String()) + }) +} + +func (suite *KeeperTestSuite) TestSwapToERC20() { + token := v1.NewToken("btc", "Bitcoin Network", "satoshi", 18, 21000000, 21000000, false, owner) + + err := suite.keeper.IssueToken( + suite.ctx, token.Symbol, token.Name, + token.MinUnit, token.Scale, token.InitialSupply, + token.MaxSupply, token.Mintable, token.GetOwner(), + ) + suite.NoError(err) + + contract, err := suite.keeper.DeployERC20(suite.ctx, token.Name, token.Symbol, token.MinUnit, uint8(token.Scale)) + suite.NoError(err) + + sender := token.GetOwner() + receiver := common.BytesToAddress(sender.Bytes()) + + balanceBefore := suite.bk.GetBalance(suite.ctx, sender, token.MinUnit) + suite.Run("swap to erc20", func() { + amount := sdk.NewCoin(token.MinUnit, sdk.NewInt(1e18)) + + err = suite.keeper.SwapToERC20(suite.ctx, sender, receiver, amount) + suite.NoError(err) + + balance, err := suite.keeper.BalanceOf(suite.ctx, contract, receiver) + suite.NoError(err) + suite.True(amount.Amount.BigInt().Cmp(balance) == 0, "SwapToERC20 failed %s != %s", amount.String(), balance.String()) + + actual := suite.bk.GetBalance(suite.ctx, sender, token.MinUnit) + suite.True(balanceBefore.Sub(amount).IsEqual(actual), "SwapToERC20 failed %s != %s", balanceBefore.String(), actual.String()) + }) +} diff --git a/modules/token/keeper/evm.go b/modules/token/keeper/evm.go new file mode 100644 index 00000000..1eaa7e61 --- /dev/null +++ b/modules/token/keeper/evm.go @@ -0,0 +1,126 @@ +package keeper + +import ( + "encoding/json" + "math/big" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + tokentypes "github.com/irisnet/irismod/modules/token/types" + "github.com/irisnet/irismod/types" +) + +// CallEVM calls the EVM with the provided contract ABI, sender and receiver addresses, method, and arguments. +// +// Parameters: +// - ctx: the context in which the EVM call is executed +// - contractABI: the ABI of the contract +// - from: the sender address +// - to: the receiver address +// - commit: boolean indicating whether the EVM call should be committed +// - method: the name of the method to be called +// - args: the arguments to be passed to the method +// +// Returns: +// - *types.Result: the result of the EVM call +// - error: an error if the EVM call encounters any issues +func (k Keeper) CallEVM( + ctx sdk.Context, + contractABI abi.ABI, + from, to common.Address, + commit bool, + method string, + args ...interface{}, +) (*types.Result, error) { + data, err := contractABI.Pack(method, args...) + if err != nil { + return nil, errorsmod.Wrap( + tokentypes.ErrABIPack, + errorsmod.Wrap(err, "failed to create transaction data").Error(), + ) + } + + resp, err := k.CallEVMWithData(ctx, from, &to, data, commit) + if err != nil { + return nil, errorsmod.Wrapf(err, "contract call failed: method '%s', contract '%s'", method, to) + } + return resp, nil +} + +// CallEVMWithData executes an Ethereum Virtual Machine (EVM) call with the provided data. +// +// Parameters: +// - ctx: the context in which the EVM call is executed +// - from: the address initiating the EVM call +// - contract: the address of the smart contract +// - data: the data to be sent with the EVM call +// - commit: boolean indicating whether the EVM call should be committed +// +// Returns: +// - *types.Result: the result of the EVM call +// - error: an error if the EVM call encounters any issues +func (k Keeper) CallEVMWithData( + ctx sdk.Context, + from common.Address, + contract *common.Address, + data []byte, + commit bool, +) (*types.Result, error) { + nonce, err := k.accountKeeper.GetSequence(ctx, from.Bytes()) + if err != nil { + return nil, err + } + + gasCap := types.DefaultGasCap + if commit { + args, err := json.Marshal(types.TransactionArgs{ + From: &from, + To: contract, + Data: (*hexutil.Bytes)(&data), + }) + if err != nil { + return nil, errorsmod.Wrapf(tokentypes.ErrJSONMarshal, "failed to marshal tx args: %s", err.Error()) + } + + gas, err := k.evmKeeper.EstimateGas(sdk.WrapSDKContext(ctx), &types.EthCallRequest{ + Args: args, + GasCap: types.DefaultGasCap, + ChainID: k.evmKeeper.ChainID().Int64(), + }) + if err != nil { + return nil, err + } + gasCap = gas + } + + msg := ethtypes.NewMessage( + from, + contract, + nonce, + big.NewInt(0), // amount + gasCap, // gasLimit + big.NewInt(0), // gasFeeCap + big.NewInt(0), // gasTipCap + big.NewInt(0), // gasPrice + data, + ethtypes.AccessList{}, // AccessList + !commit, // isFake + ) + + res, err := k.evmKeeper.ApplyMessage(ctx, msg, types.NewNoOpTracer(), commit) + if err != nil { + return nil, err + } + + if res.Failed() { + return nil, errorsmod.Wrap(tokentypes.ErrVMExecution, res.VMError) + } + + return res, nil +} diff --git a/modules/token/keeper/evm_hook.go b/modules/token/keeper/evm_hook.go new file mode 100644 index 00000000..2d52a01c --- /dev/null +++ b/modules/token/keeper/evm_hook.go @@ -0,0 +1,110 @@ +package keeper + +import ( + "math/big" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ethereum/go-ethereum/core" + ethtypes "github.com/ethereum/go-ethereum/core/types" + + "github.com/irisnet/irismod/contracts" + "github.com/irisnet/irismod/modules/token/types" +) + +type erc20Hook struct { + k Keeper +} + +// PostTxProcessing processes the transaction receipt for ERC20 token swap to native. +// +// Parameters: +// +// ctx: the context in which the function is executed. +// msg: the core message associated with the transaction. +// receipt: the Ethereum receipt containing the transaction logs. +// +// Return type: error +func (hook erc20Hook) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { + disable := !hook.k.ERC20Enabled(ctx) + erc20 := contracts.ERC20TokenContract.ABI + for _, log := range receipt.Logs { + // Note: the `SwapToNative` event contains 1 topics + // SwapToNative(address from, string to, uint256 amount) + if len(log.Topics) != 1 { + continue + } + + // Check if event is included in ERC20 + eventID := log.Topics[0] + event, err := erc20.EventByID(eventID) + if err != nil { + continue + } + + // Check if event is a `SwapToNative` event. + if event.Name != contracts.EventSwapToNative { + continue + } + + token, err := hook.k.getTokenByContract(ctx, log.Address) + if err != nil { + hook.k.Logger(ctx).Error("invalid SwapToNative event", "contract", log.Address.Hex()) + continue + } + + if disable { + return types.ErrERC20Disabled + } + + eventArgs, err := erc20.Unpack(event.Name, log.Data) + if err != nil { + return errorsmod.Wrap(types.ErrInvalidContract, "failed to unpack SwapToNative event") + } + + if len(eventArgs) != 3 { + return errorsmod.Wrapf( + types.ErrInvalidContract, + "swapToNative event has wrong number of parameters, expected 3, actual: %d", + len(eventArgs), + ) + } + + to, ok := eventArgs[1].(string) + if !ok || len(to) == 0 { + return errorsmod.Wrap( + types.ErrInvalidContract, + "swapToNative event `to` parameters is invalid, expected string", + ) + } + + receiver, err := sdk.AccAddressFromBech32(to) + if err != nil { + return errorsmod.Wrapf( + types.ErrInvalidContract, + "swapToNative event `to` parameters is invalid, expected iaa address, actual: %s", + to, + ) + } + + amount, ok := eventArgs[2].(*big.Int) + if !ok || amount.Cmp(big.NewInt(0)) == 0 { + return errorsmod.Wrap( + types.ErrInvalidContract, + "swapToNative event `amount` parameters is invalid, expected `*big.Int`", + ) + } + + mintedCoins := sdk.NewCoins(sdk.NewCoin(token.MinUnit, sdkmath.NewIntFromBigInt(amount))) + if err := hook.k.bankKeeper.MintCoins(ctx, types.ModuleName, mintedCoins); err != nil { + return err + } + + if err := hook.k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, receiver, mintedCoins); err != nil { + return err + } + } + return nil +} diff --git a/modules/token/keeper/grpc_query.go b/modules/token/keeper/grpc_query.go index f6800c9b..b651af7a 100644 --- a/modules/token/keeper/grpc_query.go +++ b/modules/token/keeper/grpc_query.go @@ -5,9 +5,11 @@ import ( "fmt" "github.com/cosmos/gogoproto/proto" + "github.com/ethereum/go-ethereum/common" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + sdkmath "cosmossdk.io/math" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" @@ -21,10 +23,16 @@ import ( var _ v1.QueryServer = Keeper{} -func (k Keeper) Token( - c context.Context, - req *v1.QueryTokenRequest, -) (*v1.QueryTokenResponse, error) { +// Token queries a token by denomination. +// +// Parameters: +// - c: Context object +// - req: QueryTokenRequest object +// +// Returns: +// - QueryTokenResponse object containing token +// - Error if any +func (k Keeper) Token(c context.Context, req *v1.QueryTokenRequest) (*v1.QueryTokenResponse, error) { if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -47,10 +55,16 @@ func (k Keeper) Token( return &v1.QueryTokenResponse{Token: any}, nil } -func (k Keeper) Tokens( - c context.Context, - req *v1.QueryTokensRequest, -) (*v1.QueryTokensResponse, error) { +// Tokens queries a list of tokens based on the given request parameters. +// +// Parameters: +// - c: Context object +// - req: QueryTokensRequest object +// +// Returns: +// - QueryTokensResponse object containing all tokens own by the owner +// - Error if any +func (k Keeper) Tokens(c context.Context, req *v1.QueryTokensRequest) (*v1.QueryTokensResponse, error) { if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -117,6 +131,15 @@ func (k Keeper) Tokens( return &v1.QueryTokensResponse{Tokens: result, Pagination: pageRes}, nil } +// Fees retrieves the issue fee and mint fee for a specific token symbol. +// +// Parameters: +// - c: Context object +// - req: QueryFeesRequest object containing the token symbol +// +// Returns: +// - QueryFeesResponse object containing issue fee, mint fee, and token existence status +// - Error if any func (k Keeper) Fees(c context.Context, req *v1.QueryFeesRequest) (*v1.QueryFeesResponse, error) { if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") @@ -145,11 +168,16 @@ func (k Keeper) Fees(c context.Context, req *v1.QueryFeesRequest) (*v1.QueryFees }, nil } -// Params return the all the parameter in tonken module -func (k Keeper) Params( - c context.Context, - req *v1.QueryParamsRequest, -) (*v1.QueryParamsResponse, error) { +// Params returns all the parameters in the token module. +// +// Parameters: +// - c: Context object +// - req: QueryParamsRequest object +// +// Returns: +// - QueryParamsResponse object containing token params +// - Error if any +func (k Keeper) Params(c context.Context, req *v1.QueryParamsRequest) (*v1.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) params := k.GetParams(ctx) @@ -157,12 +185,66 @@ func (k Keeper) Params( } // TotalBurn return the all burn coin -func (k Keeper) TotalBurn( - c context.Context, - req *v1.QueryTotalBurnRequest, -) (*v1.QueryTotalBurnResponse, error) { +// +// Parameters: +// - c: Context object +// - req: QueryFeesRequest object +// +// Returns: +// - QueryTotalBurnResponse object containing token params +// - Error if any +func (k Keeper) TotalBurn(c context.Context, req *v1.QueryTotalBurnRequest) (*v1.QueryTotalBurnResponse, error) { ctx := sdk.UnwrapSDKContext(c) + return &v1.QueryTotalBurnResponse{ BurnedCoins: k.GetAllBurnCoin(ctx), }, nil } + +// Balances retrieves the balances of a given address for a specific token. +// +// Parameters: +// - c: the context.Context object. +// - req: the v1.QueryBalancesRequest object containing the address and token denomination. +// +// Returns: +// - *v1.QueryBalancesResponse: the response containing the balances of the address for the specified token. +// - error: an error if the request is empty, the address is invalid, or the token is not found. +func (k Keeper) Balances(c context.Context, req *v1.QueryBalancesRequest) (*v1.QueryBalancesResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + addr, err := sdk.AccAddressFromBech32(req.Address) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid address (%s)", err) + } + + ctx := sdk.UnwrapSDKContext(c) + + if !k.HasToken(ctx, req.Denom) { + balance := k.bankKeeper.GetBalance(ctx, addr, req.Denom) + balances := sdk.NewCoins(balance) + return &v1.QueryBalancesResponse{Balances: balances}, nil + } + + token, err := k.GetToken(ctx, req.Denom) + if err != nil { + return nil, status.Errorf(codes.NotFound, "token %s not found", req.Denom) + } + + balance := k.bankKeeper.GetBalance(ctx, addr, token.GetMinUnit()) + balances := sdk.NewCoins(balance) + + if len(token.GetContract()) > 0 { + contract := common.HexToAddress(token.GetContract()) + account := common.BytesToAddress(addr.Bytes()) + + erc20Balance, err := k.BalanceOf(ctx, contract, account) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + balances = balances.Add(sdk.NewCoin("erc20/"+token.GetContract(), sdkmath.NewIntFromBigInt(erc20Balance))) + } + return &v1.QueryBalancesResponse{Balances: balances}, nil +} diff --git a/modules/token/keeper/grpc_query_test.go b/modules/token/keeper/grpc_query_test.go index 0488c87f..a082fe1a 100644 --- a/modules/token/keeper/grpc_query_test.go +++ b/modules/token/keeper/grpc_query_test.go @@ -19,7 +19,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryToken() { v1.RegisterQueryServer(queryHelper, app.TokenKeeper) queryClient := v1.NewQueryClient(queryHelper) - _ = suite.app.TokenKeeper.AddToken(ctx, token) + _ = suite.app.TokenKeeper.AddToken(ctx, token, true) // Query token tokenResp1, err := queryClient.Token( @@ -76,7 +76,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryTotalBurn() { _, _, addr := testdata.KeyTestPubAddr() token := v1.NewToken("btc", "Bitcoin Token", "satoshi", 18, 21000000, 22000000, true, addr) - err := suite.app.TokenKeeper.AddToken(ctx, token) + err := suite.app.TokenKeeper.AddToken(ctx, token, true) suite.Require().NoError(err) buinCoin := sdk.NewInt64Coin("satoshi", 1000000000000000000) diff --git a/modules/token/keeper/keeper.go b/modules/token/keeper/keeper.go index 4425c75b..83a72010 100644 --- a/modules/token/keeper/keeper.go +++ b/modules/token/keeper/keeper.go @@ -5,30 +5,51 @@ import ( "github.com/cometbft/cometbft/libs/log" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/token/types" v1 "github.com/irisnet/irismod/modules/token/types/v1" ) +// Keeper of the token store type Keeper struct { storeKey storetypes.StoreKey cdc codec.Codec bankKeeper types.BankKeeper + accountKeeper types.AccountKeeper + evmKeeper types.EVMKeeper + ics20Keeper types.ICS20Keeper blockedAddrs map[string]bool feeCollectorName string authority string registry v1.SwapRegistry } +// NewKeeper creates a new instance of Keeper. +// +// Parameters: +// +// cdc: codec to marshal/unmarshal binary encoding/decoding. +// key: store key for the module's store. +// bankKeeper: bank Keeper module for interacting with accounts. +// accountKeeper: Account Keeper for interacting with accounts. +// evmKeeper: EVM Keeper module for interacting with Ethereum Virtual Machine transactions. +// ics20Keeper: ICS20 Keeper module for interacting with ICS20 transactions. +// feeCollectorName: name of the fee collector. +// authority: authority string. +// +// Return type: Keeper. func NewKeeper( cdc codec.Codec, key storetypes.StoreKey, bankKeeper types.BankKeeper, + accountKeeper types.AccountKeeper, + evmKeeper types.EVMKeeper, + ics20Keeper types.ICS20Keeper, feeCollectorName string, authority string, ) Keeper { @@ -36,6 +57,9 @@ func NewKeeper( storeKey: key, cdc: cdc, bankKeeper: bankKeeper, + accountKeeper: accountKeeper, + evmKeeper: evmKeeper, + ics20Keeper: ics20Keeper, feeCollectorName: feeCollectorName, blockedAddrs: bankKeeper.GetBlockedAddresses(), registry: make(v1.SwapRegistry), @@ -53,6 +77,11 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("irismod/%s", types.ModuleName)) } +// Hooks returns the keeper's Hooks struct. +func (k Keeper) Hooks() types.Hook { + return erc20Hook{k} +} + // IssueToken issues a new token func (k Keeper) IssueToken( ctx sdk.Context, @@ -70,7 +99,7 @@ func (k Keeper) IssueToken( maxSupply, mintable, owner, ) - if err := k.AddToken(ctx, token); err != nil { + if err := k.AddToken(ctx, token, true); err != nil { return err } @@ -107,7 +136,7 @@ func (k Keeper) EditToken( } if owner.String() != token.Owner { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidOwner, "the address %s is not the owner of the token %s", owner, @@ -120,7 +149,7 @@ func (k Keeper) EditToken( issuedMainUnitAmt := issuedAmt.Quo(sdkmath.NewIntWithDecimal(1, int(token.Scale))) if sdk.NewIntFromUint64(maxSupply).LT(issuedMainUnitAmt) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidMaxSupply, "max supply must not be less than %s", issuedMainUnitAmt, @@ -132,11 +161,11 @@ func (k Keeper) EditToken( if name != v1.DoNotModify { token.Name = name - - metadata, _ := k.bankKeeper.GetDenomMetaData(ctx, token.MinUnit) - metadata.Description = name - - k.bankKeeper.SetDenomMetaData(ctx, metadata) + metadata, exist := k.bankKeeper.GetDenomMetaData(ctx, token.MinUnit) + if exist { + metadata.Description = name + k.bankKeeper.SetDenomMetaData(ctx, metadata) + } } if mintable != types.Nil { @@ -161,7 +190,7 @@ func (k Keeper) TransferTokenOwner( } if srcOwner.String() != token.Owner { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidOwner, "the address %s is not the owner of the token %s", srcOwner, @@ -195,7 +224,7 @@ func (k Keeper) MintToken( } if owner.String() != token.Owner { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidOwner, "the address %s is not the owner of the token %s", owner, @@ -204,7 +233,7 @@ func (k Keeper) MintToken( } if !token.Mintable { - return sdkerrors.Wrapf(types.ErrNotMintable, "%s", token.Symbol) + return errorsmod.Wrapf(types.ErrNotMintable, "%s", token.Symbol) } supply := k.getTokenSupply(ctx, token.MinUnit) @@ -212,7 +241,7 @@ func (k Keeper) MintToken( mintableAmt := sdk.NewIntFromUint64(token.MaxSupply).Mul(precision).Sub(supply) if coinMinted.Amount.GT(mintableAmt) { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( types.ErrInvalidAmount, "the amount exceeds the mintable token amount; expected (0, %d], got %d", mintableAmt, coinMinted.Amount, @@ -294,6 +323,10 @@ func (k Keeper) SwapFeeToken( ) } +// WithSwapRegistry sets the swap registry in the Keeper and returns the updated Keeper instance. +// +// registry: The swap registry to set. +// Returns the updated Keeper instance. func (k Keeper) WithSwapRegistry(registry v1.SwapRegistry) Keeper { k.registry = registry return k diff --git a/modules/token/keeper/keeper_test.go b/modules/token/keeper/keeper_test.go index fc5aab0c..4aa47516 100644 --- a/modules/token/keeper/keeper_test.go +++ b/modules/token/keeper/keeper_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/suite" "github.com/cometbft/cometbft/crypto/tmhash" @@ -29,6 +30,7 @@ var ( add2 = sdk.AccAddress(tmhash.SumTruncated([]byte("tokenTest1"))) initAmt = sdkmath.NewIntWithDecimal(100000000, int(6)) initCoin = sdk.Coins{sdk.NewCoin(denom, initAmt)} + beacon = common.BytesToAddress(owner.Bytes()) ) type KeeperTestSuite struct { @@ -51,7 +53,9 @@ func (suite *KeeperTestSuite) SetupTest() { suite.app = app // set params - suite.keeper.SetParams(suite.ctx, v1.DefaultParams()) + params := v1.DefaultParams() + params.Beacon = beacon.String() + suite.keeper.SetParams(suite.ctx, params) // init tokens to addr err := suite.bk.MintCoins(suite.ctx, types.ModuleName, initCoin) @@ -65,7 +69,7 @@ func TestKeeperSuite(t *testing.T) { } func (suite *KeeperTestSuite) setToken(token v1.Token) { - err := suite.keeper.AddToken(suite.ctx, token) + err := suite.keeper.AddToken(suite.ctx, token, true) suite.NoError(err) } @@ -241,7 +245,7 @@ func (suite *KeeperTestSuite) TestSwapFeeToken() { amt = suite.bk.GetBalance(suite.ctx, token2.GetOwner(), token2.MinUnit) suite.Equal("100000000000000000000t2min", amt.String()) - //reverse test + // reverse test _, feeGot, err = suite.keeper.SwapFeeToken( suite.ctx, feeGot, diff --git a/modules/token/keeper/legacy_msg_server.go b/modules/token/keeper/legacy_msg_server.go index 5a1eb7d4..75aa2971 100644 --- a/modules/token/keeper/legacy_msg_server.go +++ b/modules/token/keeper/legacy_msg_server.go @@ -63,9 +63,9 @@ func (m legacyMsgServer) MintToken(goCtx context.Context, msg *v1beta1.MsgMintTo return &v1beta1.MsgMintTokenResponse{}, err } _, err = m.server.MintToken(goCtx, &v1.MsgMintToken{ - Coin: coin, - To: msg.To, - Owner: msg.Owner, + Coin: coin, + Receiver: msg.To, + Owner: msg.Owner, }) return &v1beta1.MsgMintTokenResponse{}, err } diff --git a/modules/token/keeper/msg_server.go b/modules/token/keeper/msg_server.go index 49940050..ee16ef02 100644 --- a/modules/token/keeper/msg_server.go +++ b/modules/token/keeper/msg_server.go @@ -3,8 +3,10 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/common" "github.com/irisnet/irismod/modules/token/types" v1 "github.com/irisnet/irismod/modules/token/types/v1" @@ -32,7 +34,7 @@ func (m msgServer) IssueToken( } if m.k.blockedAddrs[msg.Owner] { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is a module account", msg.Owner) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is a module account", msg.Owner) } ctx := sdk.UnwrapSDKContext(goCtx) @@ -100,8 +102,8 @@ func (m msgServer) MintToken( var recipient sdk.AccAddress - if len(msg.To) != 0 { - recipient, err = sdk.AccAddressFromBech32(msg.To) + if len(msg.Receiver) != 0 { + recipient, err = sdk.AccAddressFromBech32(msg.Receiver) if err != nil { return nil, err } @@ -110,7 +112,7 @@ func (m msgServer) MintToken( } if m.k.blockedAddrs[recipient.String()] { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is a module account", recipient) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is a module account", recipient) } ctx := sdk.UnwrapSDKContext(goCtx) @@ -178,7 +180,7 @@ func (m msgServer) TransferTokenOwner( } if m.k.blockedAddrs[msg.DstOwner] { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrUnauthorized, "%s is a module account", msg.DstOwner, @@ -213,14 +215,14 @@ func (m msgServer) SwapFeeToken( } var recipient sdk.AccAddress - if len(msg.Recipient) > 0 { - recipient, err = sdk.AccAddressFromBech32(msg.Recipient) + if len(msg.Receiver) > 0 { + recipient, err = sdk.AccAddressFromBech32(msg.Receiver) if err != nil { return nil, err } - if m.k.blockedAddrs[msg.Recipient] { - return nil, sdkerrors.Wrapf( + if m.k.blockedAddrs[msg.Receiver] { + return nil, errorsmod.Wrapf( sdkerrors.ErrUnauthorized, "%s is a module account", recipient, @@ -238,7 +240,7 @@ func (m msgServer) SwapFeeToken( sdk.NewEvent( types.EventTypeSwapFeeToken, sdk.NewAttribute(types.AttributeKeySender, msg.Sender), - sdk.NewAttribute(types.AttributeKeyRecipient, msg.Recipient), + sdk.NewAttribute(types.AttributeKeyRecipient, msg.Receiver), sdk.NewAttribute(types.AttributeKeyFeePaid, feePaid.String()), sdk.NewAttribute(types.AttributeKeyFeeGot, feeGot.String()), ), @@ -254,7 +256,7 @@ func (m msgServer) UpdateParams( msg *v1.MsgUpdateParams, ) (*v1.MsgUpdateParamsResponse, error) { if m.k.authority != msg.Authority { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrUnauthorized, "invalid authority; expected %s, got %s", m.k.authority, @@ -268,3 +270,75 @@ func (m msgServer) UpdateParams( } return &v1.MsgUpdateParamsResponse{}, nil } + +// DeployERC20 implements v1.MsgServer. +func (m msgServer) DeployERC20(goCtx context.Context, msg *v1.MsgDeployERC20) (*v1.MsgDeployERC20Response, error) { + if m.k.authority != msg.Authority { + return nil, errorsmod.Wrapf( + sdkerrors.ErrUnauthorized, + "invalid authority; expected %s, got %s", + m.k.authority, + msg.Authority, + ) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + _, err := m.k.DeployERC20(ctx, msg.Name, msg.Symbol, msg.MinUnit, uint8(msg.Scale)) + if err != nil { + return nil, err + } + return &v1.MsgDeployERC20Response{}, nil +} + +// SwapFromERC20 implements v1.MsgServer. +func (m msgServer) SwapFromERC20(goCtx context.Context, msg *v1.MsgSwapFromERC20) (*v1.MsgSwapFromERC20Response, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + receiver, err := sdk.AccAddressFromBech32(msg.Receiver) + if err != nil { + return nil, err + } + + if err := m.k.SwapFromERC20(ctx, common.BytesToAddress(sender.Bytes()), receiver, msg.WantedAmount); err != nil { + return nil, err + } + return &v1.MsgSwapFromERC20Response{}, nil +} + +// SwapToERC20 implements v1.MsgServer. +func (m msgServer) SwapToERC20(goCtx context.Context, msg *v1.MsgSwapToERC20) (*v1.MsgSwapToERC20Response, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + receiver := common.HexToAddress(msg.Receiver) + if err := m.k.SwapToERC20(ctx, sender, receiver, msg.Amount); err != nil { + return nil, err + } + return &v1.MsgSwapToERC20Response{}, nil +} + +// UpgradeERC20 implements v1.MsgServer. +func (m msgServer) UpgradeERC20(goCtx context.Context, msg *v1.MsgUpgradeERC20) (*v1.MsgUpgradeERC20Response, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + if m.k.authority != msg.Authority { + return nil, errorsmod.Wrapf( + sdkerrors.ErrUnauthorized, + "invalid authority; expected %s, got %s", + m.k.authority, + msg.Authority, + ) + } + + implementation := common.HexToAddress(msg.Implementation) + if err := m.k.UpgradeERC20(ctx, implementation); err != nil { + return nil, err + } + return &v1.MsgUpgradeERC20Response{}, nil +} diff --git a/modules/token/keeper/pagination_test.go b/modules/token/keeper/pagination_test.go index 5558257c..b1d6d880 100644 --- a/modules/token/keeper/pagination_test.go +++ b/modules/token/keeper/pagination_test.go @@ -1,9 +1,10 @@ package keeper import ( + "testing" + "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" - "testing" ) var ShapePageRequest = shapePageRequest diff --git a/modules/token/keeper/params.go b/modules/token/keeper/params.go index b0a68604..bfdf6d36 100644 --- a/modules/token/keeper/params.go +++ b/modules/token/keeper/params.go @@ -10,7 +10,7 @@ import ( // GetParams sets the token module parameters. func (k Keeper) GetParams(ctx sdk.Context) (params v1.Params) { store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(types.ParamsKey)) + bz := store.Get([]byte(types.PrefixParamsKey)) if bz == nil { return params } @@ -30,7 +30,13 @@ func (k Keeper) SetParams(ctx sdk.Context, params v1.Params) error { if err != nil { return err } - store.Set(types.ParamsKey, bz) + store.Set(types.PrefixParamsKey, bz) return nil } + +// ERC20Enabled returns true if ERC20 is enabled +func (k Keeper) ERC20Enabled(ctx sdk.Context) bool { + params := k.GetParams(ctx) + return params.EnableErc20 +} diff --git a/modules/token/keeper/token.go b/modules/token/keeper/token.go index a856df5c..5ac0621f 100644 --- a/modules/token/keeper/token.go +++ b/modules/token/keeper/token.go @@ -4,9 +4,10 @@ import ( "fmt" gogotypes "github.com/cosmos/gogoproto/types" + "github.com/ethereum/go-ethereum/common" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/irisnet/irismod/modules/token/types" @@ -59,52 +60,18 @@ func (k Keeper) GetToken(ctx sdk.Context, denom string) (v1.TokenI, error) { return &token, nil } - return nil, sdkerrors.Wrapf(types.ErrTokenNotExists, "token: %s does not exist", denom) + return nil, errorsmod.Wrapf(types.ErrTokenNotExists, "token: %s does not exist", denom) } // AddToken saves a new token -func (k Keeper) AddToken(ctx sdk.Context, token v1.Token) error { - if k.HasToken(ctx, token.Symbol) { - return sdkerrors.Wrapf( - types.ErrSymbolAlreadyExists, - "symbol already exists: %s", - token.Symbol, - ) - } - - if k.HasToken(ctx, token.MinUnit) { - return sdkerrors.Wrapf( - types.ErrMinUnitAlreadyExists, - "min-unit already exists: %s", - token.MinUnit, - ) - } - - // set token - k.setToken(ctx, token) - - // set token to be prefixed with min unit - k.setWithMinUnit(ctx, token.MinUnit, token.Symbol) - - if len(token.Owner) != 0 { - // set token to be prefixed with owner - k.setWithOwner(ctx, token.GetOwner(), token.Symbol) +func (k Keeper) AddToken(ctx sdk.Context, token v1.Token, saveDenomMetaData bool) error { + if err := k.assertTokenValid(ctx, token); err != nil { + return err } - - denomMetaData := banktypes.Metadata{ - Description: token.Name, - Base: token.MinUnit, - Display: token.Symbol, - DenomUnits: []*banktypes.DenomUnit{ - {Denom: token.MinUnit, Exponent: 0}, - {Denom: token.Symbol, Exponent: token.Scale}, - }, + k.upsertToken(ctx, token) + if saveDenomMetaData { + k.setDenomMetaData(ctx, token) } - k.bankKeeper.SetDenomMetaData(ctx, denomMetaData) - - // Set token to be prefixed with min_unit - k.setWithMinUnit(ctx, token.MinUnit, token.Symbol) - return nil } @@ -114,14 +81,24 @@ func (k Keeper) HasSymbol(ctx sdk.Context, symbol string) bool { return store.Has(types.KeySymbol(symbol)) } +// HasMinUint asserts a token exists by minUint +func (k Keeper) HasMinUint(ctx sdk.Context, minUint string) bool { + store := ctx.KVStore(k.storeKey) + return store.Has(types.KeyMinUint(minUint)) +} + +// HasContract asserts a token exists by contract +func (k Keeper) HasContract(ctx sdk.Context, contract string) bool { + store := ctx.KVStore(k.storeKey) + return store.Has(types.KeyContract(contract)) +} + // HasToken asserts a token exists func (k Keeper) HasToken(ctx sdk.Context, denom string) bool { - store := ctx.KVStore(k.storeKey) if k.HasSymbol(ctx, denom) { return true } - - return store.Has(types.KeyMinUint(denom)) + return k.HasMinUint(ctx, denom) } // GetOwner returns the owner of the specified token @@ -136,7 +113,7 @@ func (k Keeper) GetOwner(ctx sdk.Context, denom string) (sdk.AccAddress, error) // AddBurnCoin saves the total amount of the burned tokens func (k Keeper) AddBurnCoin(ctx sdk.Context, coin sdk.Coin) { - var total = coin + total := coin if hasCoin, err := k.GetBurnCoin(ctx, coin.Denom); err == nil { total = total.Add(hasCoin) } @@ -155,7 +132,7 @@ func (k Keeper) GetBurnCoin(ctx sdk.Context, minUint string) (sdk.Coin, error) { bz := store.Get(key) if len(bz) == 0 { - return sdk.Coin{}, sdkerrors.Wrapf( + return sdk.Coin{}, errorsmod.Wrapf( types.ErrNotFoundTokenAmt, "not found symbol: %s", minUint, @@ -173,7 +150,7 @@ func (k Keeper) GetAllBurnCoin(ctx sdk.Context) []sdk.Coin { store := ctx.KVStore(k.storeKey) var coins []sdk.Coin - it := sdk.KVStorePrefixIterator(store, types.PeffixBurnTokenAmt) + it := sdk.KVStorePrefixIterator(store, types.PrefixBurnTokenAmt) for ; it.Valid(); it.Next() { var coin sdk.Coin k.cdc.MustUnmarshal(it.Value(), &coin) @@ -199,6 +176,14 @@ func (k Keeper) setWithMinUnit(ctx sdk.Context, minUnit, symbol string) { store.Set(types.KeyMinUint(minUnit), bz) } +func (k Keeper) setWithContract(ctx sdk.Context, contract, symbol string) { + store := ctx.KVStore(k.storeKey) + + bz := k.cdc.MustMarshal(&gogotypes.StringValue{Value: symbol}) + + store.Set(types.KeyContract(contract), bz) +} + func (k Keeper) setToken(ctx sdk.Context, token v1.Token) { store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshal(&token) @@ -211,7 +196,7 @@ func (k Keeper) getTokenBySymbol(ctx sdk.Context, symbol string) (token v1.Token bz := store.Get(types.KeySymbol(symbol)) if bz == nil { - return token, sdkerrors.Wrap( + return token, errorsmod.Wrap( types.ErrTokenNotExists, fmt.Sprintf("token symbol %s does not exist", symbol), ) @@ -226,7 +211,7 @@ func (k Keeper) getTokenByMinUnit(ctx sdk.Context, minUnit string) (token v1.Tok bz := store.Get(types.KeyMinUint(minUnit)) if bz == nil { - return token, sdkerrors.Wrap( + return token, errorsmod.Wrap( types.ErrTokenNotExists, fmt.Sprintf("token minUnit %s does not exist", minUnit), ) @@ -243,12 +228,34 @@ func (k Keeper) getTokenByMinUnit(ctx sdk.Context, minUnit string) (token v1.Tok return token, nil } +func (k Keeper) getTokenByContract(ctx sdk.Context, contract common.Address) (token v1.Token, err error) { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(types.KeyContract(contract.Hex())) + if bz == nil { + return token, errorsmod.Wrap( + types.ErrTokenNotExists, + fmt.Sprintf("token contract %s does not exist", contract), + ) + } + + var symbol gogotypes.StringValue + k.cdc.MustUnmarshal(bz, &symbol) + + token, err = k.getTokenBySymbol(ctx, symbol.Value) + if err != nil { + return token, err + } + + return token, nil +} + func (k Keeper) getSymbolByMinUnit(ctx sdk.Context, minUnit string) (string, error) { store := ctx.KVStore(k.storeKey) bz := store.Get(types.KeyMinUint(minUnit)) if bz == nil { - return "", sdkerrors.Wrap( + return "", errorsmod.Wrap( types.ErrTokenNotExists, fmt.Sprintf("token minUnit %s does not exist", minUnit), ) @@ -279,3 +286,74 @@ func (k Keeper) resetStoreKeyForQueryToken( func (k Keeper) getTokenSupply(ctx sdk.Context, denom string) sdk.Int { return k.bankKeeper.GetSupply(ctx, denom).Amount } + +// upsertToken updates or inserts a token into the database. +// +// ctx: the context in which the token is being upserted. +// token: the token struct to be upserted. +func (k Keeper) upsertToken(ctx sdk.Context, token v1.Token) { + // set token + k.setToken(ctx, token) + // set token to be prefixed with min unit + k.setWithMinUnit(ctx, token.MinUnit, token.Symbol) + if len(token.Owner) != 0 { + // set token to be prefixed with owner + k.setWithOwner(ctx, token.GetOwner(), token.Symbol) + } + if len(token.Contract) != 0 { + // set token to be prefixed with owner + k.setWithContract(ctx, token.Contract, token.Symbol) + } +} + +func (k Keeper) setDenomMetaData(ctx sdk.Context, token v1.Token) { + denomMetaData := banktypes.Metadata{ + Description: token.Name, + Base: token.MinUnit, + Display: token.Symbol, + DenomUnits: []*banktypes.DenomUnit{ + {Denom: token.MinUnit, Exponent: 0}, + {Denom: token.Symbol, Exponent: token.Scale}, + }, + } + k.bankKeeper.SetDenomMetaData(ctx, denomMetaData) +} + +func (k Keeper) assertTokenValid(ctx sdk.Context, token v1.Token) error { + if k.HasSymbol(ctx, token.Symbol) { + return errorsmod.Wrapf( + types.ErrSymbolAlreadyExists, + "symbol already exists: %s", + token.Symbol, + ) + } + + if k.HasMinUint(ctx, token.MinUnit) { + return errorsmod.Wrapf( + types.ErrMinUnitAlreadyExists, + "min-unit already exists: %s", + token.MinUnit, + ) + } + + if len(token.Contract) == 0 { + return nil + } + + if !common.IsHexAddress(token.Contract) { + return errorsmod.Wrapf( + types.ErrInvalidContract, + "invalid contract address: %s", + token.Contract, + ) + } + + if k.HasContract(ctx, token.Contract) { + return errorsmod.Wrapf( + types.ErrERC20AlreadyExists, + "contract already exists: %s", + token.Contract, + ) + } + return nil +} diff --git a/modules/token/migrations/v2/migrate_test.go b/modules/token/migrations/v2/migrate_test.go index b36a272c..563821dd 100644 --- a/modules/token/migrations/v2/migrate_test.go +++ b/modules/token/migrations/v2/migrate_test.go @@ -30,6 +30,8 @@ func TestMigrate(t *testing.T) { require.NoError(t, err) expParams := app.TokenKeeper.GetParams(ctx) + // compatible with previous logic + expParams.EnableErc20 = true require.Equal(t, expParams, params, "v2.Migrate failed") } diff --git a/modules/token/simulation/decoder.go b/modules/token/simulation/decoder.go index e01161dd..477221cb 100644 --- a/modules/token/simulation/decoder.go +++ b/modules/token/simulation/decoder.go @@ -9,6 +9,7 @@ import ( gogotypes "github.com/cosmos/gogoproto/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" "github.com/irisnet/irismod/modules/token/types" @@ -34,6 +35,21 @@ func NewDecodeStore(cdc codec.BinaryCodec) func(kvA, kvB kv.Pair) string { cdc.MustUnmarshal(kvA.Value, &symbolA) cdc.MustUnmarshal(kvB.Value, &symbolB) return fmt.Sprintf("%v\n%v", symbolA, symbolB) + case bytes.Equal(kvA.Key[:1], types.PrefixBurnTokenAmt): + var burntCoinA, burntCoinB sdk.Coin + cdc.MustUnmarshal(kvA.Value, &burntCoinA) + cdc.MustUnmarshal(kvB.Value, &burntCoinB) + return fmt.Sprintf("%v\n%v", burntCoinA, burntCoinB) + case bytes.Equal(kvA.Key[:1], types.PrefixParamsKey): + var paramsA, paramsB v1.Params + cdc.MustUnmarshal(kvA.Value, ¶msA) + cdc.MustUnmarshal(kvB.Value, ¶msB) + return fmt.Sprintf("%v\n%v", paramsA, paramsB) + case bytes.Equal(kvA.Key[:1], types.PrefixTokenForContract): + var symbolA, symbolB gogotypes.Value + cdc.MustUnmarshal(kvA.Value, &symbolA) + cdc.MustUnmarshal(kvB.Value, &symbolB) + return fmt.Sprintf("%v\n%v", symbolA, symbolB) default: panic(fmt.Sprintf("invalid %s key prefix %X", types.ModuleName, kvA.Key[:1])) } diff --git a/modules/token/simulation/genesis.go b/modules/token/simulation/genesis.go index 7d73f6b1..eadb1dea 100644 --- a/modules/token/simulation/genesis.go +++ b/modules/token/simulation/genesis.go @@ -19,6 +19,7 @@ const ( TokenTaxRate = "token_tax_rate" IssueTokenBaseFee = "issue_token_base_fee" MintTokenFeeRatio = "mint_token_fee_ratio" + EnableErc20 = "enable_erc20" ) // RandomDec randomized sdk.RandomDec @@ -33,10 +34,10 @@ func RandomInt(r *rand.Rand) sdk.Int { // RandomizedGenState generates a random GenesisState for bank func RandomizedGenState(simState *module.SimulationState) { - var tokenTaxRate sdk.Dec var issueTokenBaseFee sdk.Int var mintTokenFeeRatio sdk.Dec + var enableErc20 bool var tokens []v1.Token simState.AppParams.GetOrGenerate( @@ -61,8 +62,15 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { mintTokenFeeRatio = sdk.NewDecWithPrec(int64(r.Intn(5)), 1) }, ) + simState.AppParams.GetOrGenerate( + simState.Cdc, EnableErc20, &enableErc20, simState.Rand, + func(r *rand.Rand) { + enableErc20 = true + }, + ) + tokenGenesis := v1.NewGenesisState( - v1.NewParams(tokenTaxRate, sdk.NewCoin(sdk.DefaultBondDenom, issueTokenBaseFee), mintTokenFeeRatio), + v1.NewParams(tokenTaxRate, sdk.NewCoin(sdk.DefaultBondDenom, issueTokenBaseFee), mintTokenFeeRatio, enableErc20, ""), tokens, ) diff --git a/modules/token/simulation/operations.go b/modules/token/simulation/operations.go index 27af3fa4..75ca34a3 100644 --- a/modules/token/simulation/operations.go +++ b/modules/token/simulation/operations.go @@ -281,8 +281,8 @@ func SimulateMintToken( Denom: token.GetMinUnit(), Amount: sdkmath.NewIntWithDecimal(100, int(token.GetScale())), }, - To: simToAccount.Address.String(), - Owner: token.GetOwner().String(), + Receiver: simToAccount.Address.String(), + Owner: token.GetOwner().String(), } ownerAccount, found := simtypes.FindAccount(accs, token.GetOwner()) diff --git a/modules/token/types/errors.go b/modules/token/types/errors.go index 24e4bc6f..407d8f88 100644 --- a/modules/token/types/errors.go +++ b/modules/token/types/errors.go @@ -2,26 +2,35 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // token module sentinel errors var ( - ErrInvalidName = sdkerrors.Register(ModuleName, 2, "invalid token name") - ErrInvalidMinUnit = sdkerrors.Register(ModuleName, 3, "invalid token min unit") - ErrInvalidSymbol = sdkerrors.Register(ModuleName, 4, "invalid standard denom") - ErrInvalidInitSupply = sdkerrors.Register(ModuleName, 5, "invalid token initial supply") - ErrInvalidMaxSupply = sdkerrors.Register(ModuleName, 6, "invalid token maximum supply") - ErrInvalidScale = sdkerrors.Register(ModuleName, 7, "invalid token scale") - ErrSymbolAlreadyExists = sdkerrors.Register(ModuleName, 8, "symbol already exists") - ErrMinUnitAlreadyExists = sdkerrors.Register(ModuleName, 9, "min unit already exists") - ErrTokenNotExists = sdkerrors.Register(ModuleName, 10, "token does not exist") - ErrInvalidToAddress = sdkerrors.Register(ModuleName, 11, "the new owner must not be same as the original owner") - ErrInvalidOwner = sdkerrors.Register(ModuleName, 12, "invalid token owner") - ErrNotMintable = sdkerrors.Register(ModuleName, 13, "token is not mintable") - ErrNotFoundTokenAmt = sdkerrors.Register(ModuleName, 14, "burned token amount not found") - ErrInvalidAmount = sdkerrors.Register(ModuleName, 15, "invalid amount") - ErrInvalidBaseFee = sdkerrors.Register(ModuleName, 16, "invalid base fee") - ErrInvalidSwap = sdkerrors.Register(ModuleName, 17, "unregistered swapable fee token") - ErrInsufficientFee = sdkerrors.Register(ModuleName, 18, "the amount of tokens after swap is less than 1") + ErrInvalidName = errorsmod.Register(ModuleName, 2, "invalid token name") + ErrInvalidMinUnit = errorsmod.Register(ModuleName, 3, "invalid token min unit") + ErrInvalidSymbol = errorsmod.Register(ModuleName, 4, "invalid standard denom") + ErrInvalidInitSupply = errorsmod.Register(ModuleName, 5, "invalid token initial supply") + ErrInvalidMaxSupply = errorsmod.Register(ModuleName, 6, "invalid token maximum supply") + ErrInvalidScale = errorsmod.Register(ModuleName, 7, "invalid token scale") + ErrSymbolAlreadyExists = errorsmod.Register(ModuleName, 8, "symbol already exists") + ErrMinUnitAlreadyExists = errorsmod.Register(ModuleName, 9, "min unit already exists") + ErrTokenNotExists = errorsmod.Register(ModuleName, 10, "token does not exist") + ErrInvalidToAddress = errorsmod.Register(ModuleName, 11, "the new owner must not be same as the original owner") + ErrInvalidOwner = errorsmod.Register(ModuleName, 12, "invalid token owner") + ErrNotMintable = errorsmod.Register(ModuleName, 13, "token is not mintable") + ErrNotFoundTokenAmt = errorsmod.Register(ModuleName, 14, "burned token amount not found") + ErrInvalidAmount = errorsmod.Register(ModuleName, 15, "invalid amount") + ErrInvalidBaseFee = errorsmod.Register(ModuleName, 16, "invalid base fee") + ErrInvalidSwap = errorsmod.Register(ModuleName, 17, "unregistered swapable fee token") + ErrInsufficientFee = errorsmod.Register(ModuleName, 18, "the amount of tokens after swap is less than 1") + ErrJSONMarshal = errorsmod.Register(ModuleName, 19, "failed to marshal JSON bytes") + ErrVMExecution = errorsmod.Register(ModuleName, 20, "evm transaction execution failed") + ErrABIPack = errorsmod.Register(ModuleName, 21, "contract ABI pack failed") + ErrERC20AlreadyExists = errorsmod.Register(ModuleName, 22, "erc20 contract already exists") + ErrERC20NotDeployed = errorsmod.Register(ModuleName, 23, "erc20 contract not deployed") + ErrUnsupportedKey = errorsmod.Register(ModuleName, 24, "evm not supported public key") + ErrInvalidContract = errorsmod.Register(ModuleName, 25, "invalid contract") + ErrERC20Disabled = errorsmod.Register(ModuleName, 26, "erc20 swap is disabled") + ErrBeaconNotSet = errorsmod.Register(ModuleName, 27, "beacon contract not set") ) diff --git a/modules/token/types/expected_keepers.go b/modules/token/types/expected_keepers.go index e5922c19..d091a489 100644 --- a/modules/token/types/expected_keepers.go +++ b/modules/token/types/expected_keepers.go @@ -1,9 +1,19 @@ package types import ( + "context" + "math/big" + + "github.com/ethereum/go-ethereum/core" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + + "github.com/irisnet/irismod/types" ) // BankKeeper defines the expected bank keeper (noalias) @@ -41,7 +51,26 @@ type BankKeeper interface { // AccountKeeper defines the expected account keeper type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI + GetModuleAddress(moduleName string) sdk.AccAddress + GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) + GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI + GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI +} + +// EVMKeeper defines the expected keeper of the evm module +type EVMKeeper interface { + ChainID() *big.Int + SupportedKey(pubKey cryptotypes.PubKey) bool + EstimateGas(ctx context.Context, req *types.EthCallRequest) (uint64, error) + ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLogger, commit bool) (*types.Result, error) +} + +// ICS20Keeper defines the expected keeper of ICS20 +type ICS20Keeper interface { + HasTrace(ctx sdk.Context, denom string) bool +} + +// Hook defines the hook interface +type Hook interface { + PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error } diff --git a/modules/token/types/keys.go b/modules/token/types/keys.go index 9b7cf196..38648808 100644 --- a/modules/token/types/keys.go +++ b/modules/token/types/keys.go @@ -2,6 +2,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" ) const ( @@ -28,9 +29,12 @@ var ( PrefixTokenForMinUint = []byte{0x02} // PrefixTokens defines a prefix for the tokens PrefixTokens = []byte{0x03} - // PeffixBurnTokenAmt defines a prefix for the amount of token burnt - PeffixBurnTokenAmt = []byte{0x04} - ParamsKey = []byte{0x05} // prefix for the token params + // PrefixBurnTokenAmt defines a prefix for the amount of token burnt + PrefixBurnTokenAmt = []byte{0x04} + // PrefixParamsKey defines the key for the Params store + PrefixParamsKey = []byte{0x05} + // PrefixTokenForContract defines the erc20 contract prefix for the token + PrefixTokenForContract = []byte{0x06} ) // KeySymbol returns the key of the token with the specified symbol @@ -43,6 +47,12 @@ func KeyMinUint(minUnit string) []byte { return append(PrefixTokenForMinUint, []byte(minUnit)...) } +// KeyContract returns the key of the token with the specified contract +func KeyContract(contract string) []byte { + bz := common.HexToAddress(contract).Bytes() + return append(PrefixTokenForContract, bz...) +} + // KeyTokens returns the key of the specified owner and symbol. Intended for querying all tokens of an owner func KeyTokens(owner sdk.AccAddress, symbol string) []byte { return append(append(PrefixTokens, owner.Bytes()...), []byte(symbol)...) @@ -50,5 +60,5 @@ func KeyTokens(owner sdk.AccAddress, symbol string) []byte { // KeyBurnTokenAmt returns the key of the specified min unit. func KeyBurnTokenAmt(minUint string) []byte { - return append(PeffixBurnTokenAmt, []byte(minUint)...) + return append(PrefixBurnTokenAmt, []byte(minUint)...) } diff --git a/modules/token/types/v1/event.pb.go b/modules/token/types/v1/event.pb.go new file mode 100644 index 00000000..aaac3530 --- /dev/null +++ b/modules/token/types/v1/event.pb.go @@ -0,0 +1,1094 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: irismod/token/v1/event.proto + +package v1 + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "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 + +// EventDeployERC20 is an event emitted when deploying ERC20. +type EventDeployERC20 struct { + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Scale uint32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"` + MinUnit string `protobuf:"bytes,4,opt,name=min_unit,json=minUnit,proto3" json:"min_unit,omitempty"` + Contract string `protobuf:"bytes,5,opt,name=contract,proto3" json:"contract,omitempty"` +} + +func (m *EventDeployERC20) Reset() { *m = EventDeployERC20{} } +func (m *EventDeployERC20) String() string { return proto.CompactTextString(m) } +func (*EventDeployERC20) ProtoMessage() {} +func (*EventDeployERC20) Descriptor() ([]byte, []int) { + return fileDescriptor_b15e65dad722cc70, []int{0} +} +func (m *EventDeployERC20) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventDeployERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventDeployERC20.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 *EventDeployERC20) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventDeployERC20.Merge(m, src) +} +func (m *EventDeployERC20) XXX_Size() int { + return m.Size() +} +func (m *EventDeployERC20) XXX_DiscardUnknown() { + xxx_messageInfo_EventDeployERC20.DiscardUnknown(m) +} + +var xxx_messageInfo_EventDeployERC20 proto.InternalMessageInfo + +// EventSwapToERC20 is an event emitted when swapping token from native token to +// ERC20. +type EventSwapToERC20 struct { + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` + ToContract string `protobuf:"bytes,4,opt,name=to_contract,json=toContract,proto3" json:"to_contract,omitempty"` +} + +func (m *EventSwapToERC20) Reset() { *m = EventSwapToERC20{} } +func (m *EventSwapToERC20) String() string { return proto.CompactTextString(m) } +func (*EventSwapToERC20) ProtoMessage() {} +func (*EventSwapToERC20) Descriptor() ([]byte, []int) { + return fileDescriptor_b15e65dad722cc70, []int{1} +} +func (m *EventSwapToERC20) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventSwapToERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventSwapToERC20.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 *EventSwapToERC20) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventSwapToERC20.Merge(m, src) +} +func (m *EventSwapToERC20) XXX_Size() int { + return m.Size() +} +func (m *EventSwapToERC20) XXX_DiscardUnknown() { + xxx_messageInfo_EventSwapToERC20.DiscardUnknown(m) +} + +var xxx_messageInfo_EventSwapToERC20 proto.InternalMessageInfo + +// EventSwapFromERC20 is an event emitted when swapping token from ERC20 to +// native token. +type EventSwapFromERC20 struct { + WantedAmount *types.Coin `protobuf:"bytes,1,opt,name=wanted_amount,json=wantedAmount,proto3" json:"wanted_amount,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` + FromContract string `protobuf:"bytes,4,opt,name=from_contract,json=fromContract,proto3" json:"from_contract,omitempty"` +} + +func (m *EventSwapFromERC20) Reset() { *m = EventSwapFromERC20{} } +func (m *EventSwapFromERC20) String() string { return proto.CompactTextString(m) } +func (*EventSwapFromERC20) ProtoMessage() {} +func (*EventSwapFromERC20) Descriptor() ([]byte, []int) { + return fileDescriptor_b15e65dad722cc70, []int{2} +} +func (m *EventSwapFromERC20) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventSwapFromERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventSwapFromERC20.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 *EventSwapFromERC20) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventSwapFromERC20.Merge(m, src) +} +func (m *EventSwapFromERC20) XXX_Size() int { + return m.Size() +} +func (m *EventSwapFromERC20) XXX_DiscardUnknown() { + xxx_messageInfo_EventSwapFromERC20.DiscardUnknown(m) +} + +var xxx_messageInfo_EventSwapFromERC20 proto.InternalMessageInfo + +func init() { + proto.RegisterType((*EventDeployERC20)(nil), "irismod.token.v1.EventDeployERC20") + proto.RegisterType((*EventSwapToERC20)(nil), "irismod.token.v1.EventSwapToERC20") + proto.RegisterType((*EventSwapFromERC20)(nil), "irismod.token.v1.EventSwapFromERC20") +} + +func init() { proto.RegisterFile("irismod/token/v1/event.proto", fileDescriptor_b15e65dad722cc70) } + +var fileDescriptor_b15e65dad722cc70 = []byte{ + // 448 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x41, 0x6b, 0x13, 0x41, + 0x1c, 0xc5, 0x77, 0x35, 0x8d, 0xed, 0xb4, 0x81, 0x32, 0x04, 0xd9, 0x04, 0xd9, 0x96, 0x7a, 0xe9, + 0xc5, 0x9d, 0x6e, 0x15, 0xbc, 0x09, 0x4d, 0xac, 0x57, 0x61, 0xab, 0x17, 0x2f, 0x61, 0xb2, 0xfb, + 0x37, 0x0e, 0x66, 0xe6, 0x1f, 0x66, 0x26, 0x5b, 0xf2, 0x19, 0xbc, 0xf8, 0x61, 0x3c, 0xf9, 0x09, + 0x72, 0x2c, 0x9e, 0x3c, 0x89, 0x4d, 0xbe, 0x88, 0xec, 0xcc, 0x24, 0x42, 0x0f, 0x22, 0xbd, 0xed, + 0x9b, 0xf7, 0xfe, 0xec, 0xfb, 0xc1, 0x23, 0x4f, 0x84, 0x16, 0x46, 0x62, 0xc5, 0x2c, 0x7e, 0x06, + 0xc5, 0xea, 0x9c, 0x41, 0x0d, 0xca, 0x66, 0x33, 0x8d, 0x16, 0xe9, 0x61, 0x70, 0x33, 0xe7, 0x66, + 0x75, 0xde, 0xef, 0x4e, 0x70, 0x82, 0xce, 0x64, 0xcd, 0x97, 0xcf, 0xf5, 0xd3, 0x12, 0x8d, 0x44, + 0xc3, 0xc6, 0xdc, 0x00, 0xab, 0xf3, 0x31, 0x58, 0x9e, 0xb3, 0x12, 0x85, 0x0a, 0x7e, 0xcf, 0xfb, + 0x23, 0x7f, 0xe8, 0x85, 0xb7, 0x4e, 0xbe, 0xc4, 0xe4, 0xf0, 0xb2, 0xf9, 0xe5, 0x6b, 0x98, 0x4d, + 0x71, 0x71, 0x59, 0x0c, 0xcf, 0xcf, 0xe8, 0x63, 0xd2, 0x36, 0x0b, 0x39, 0xc6, 0x69, 0x12, 0x1f, + 0xc7, 0xa7, 0x7b, 0x45, 0x50, 0x94, 0x92, 0x96, 0xe2, 0x12, 0x92, 0x07, 0xee, 0xd5, 0x7d, 0xd3, + 0x2e, 0xd9, 0x31, 0x25, 0x9f, 0x42, 0xf2, 0xf0, 0x38, 0x3e, 0xed, 0x14, 0x5e, 0xd0, 0x1e, 0xd9, + 0x95, 0x42, 0x8d, 0xe6, 0x4a, 0xd8, 0xa4, 0xe5, 0xd2, 0x8f, 0xa4, 0x50, 0xef, 0x95, 0xb0, 0xb4, + 0x4f, 0x76, 0x4b, 0x54, 0x56, 0xf3, 0xd2, 0x26, 0x3b, 0xce, 0xda, 0xea, 0x93, 0xef, 0x9b, 0x36, + 0x57, 0xd7, 0x7c, 0xf6, 0x0e, 0x7d, 0x9b, 0x97, 0xa4, 0xcd, 0x25, 0xce, 0x95, 0x75, 0x6d, 0xf6, + 0xcf, 0x7b, 0x59, 0x20, 0x68, 0x70, 0xb3, 0x80, 0x9b, 0x0d, 0x51, 0xa8, 0x41, 0x6b, 0xf9, 0xeb, + 0x28, 0x2a, 0x42, 0x9c, 0x9e, 0x91, 0xb6, 0x01, 0x55, 0x81, 0xf6, 0x85, 0x07, 0xc9, 0x8f, 0x6f, + 0xcf, 0xba, 0xe1, 0xf6, 0xa2, 0xaa, 0x34, 0x18, 0x73, 0x65, 0xb5, 0x50, 0x93, 0x22, 0xe4, 0x9a, + 0x6e, 0x1a, 0x4a, 0x10, 0x35, 0x68, 0xc7, 0xb3, 0x57, 0x6c, 0x35, 0x3d, 0x22, 0xfb, 0x16, 0x47, + 0xdb, 0xea, 0x9e, 0x8a, 0x58, 0x1c, 0x6e, 0xca, 0xdf, 0xc6, 0x84, 0x6e, 0xcb, 0xbf, 0xd1, 0x28, + 0x7d, 0xfd, 0x57, 0xa4, 0x73, 0xcd, 0x95, 0x85, 0x6a, 0xf4, 0x9f, 0x14, 0xc5, 0x81, 0xcf, 0x5f, + 0xdc, 0x97, 0xe2, 0xc5, 0x5d, 0x8a, 0x7f, 0xdc, 0xfc, 0xe5, 0x7b, 0x4a, 0x3a, 0x1f, 0x35, 0xca, + 0xbb, 0x84, 0x07, 0xcd, 0xe3, 0x86, 0x71, 0xf0, 0x76, 0x79, 0x9b, 0x46, 0xcb, 0x55, 0x1a, 0xdf, + 0xac, 0xd2, 0xf8, 0xf7, 0x2a, 0x8d, 0xbf, 0xae, 0xd3, 0xe8, 0x66, 0x9d, 0x46, 0x3f, 0xd7, 0x69, + 0xf4, 0x21, 0x9f, 0x08, 0xfb, 0x69, 0x3e, 0xce, 0x4a, 0x94, 0xac, 0x99, 0xae, 0x02, 0xcb, 0x36, + 0x03, 0x97, 0x58, 0xcd, 0xa7, 0x60, 0xc2, 0xd0, 0xed, 0x62, 0x06, 0xa6, 0x99, 0x6a, 0xdb, 0xcd, + 0xf0, 0xf9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x69, 0x98, 0x86, 0x71, 0x09, 0x03, 0x00, 0x00, +} + +func (m *EventDeployERC20) 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 *EventDeployERC20) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventDeployERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0x2a + } + if len(m.MinUnit) > 0 { + i -= len(m.MinUnit) + copy(dAtA[i:], m.MinUnit) + i = encodeVarintEvent(dAtA, i, uint64(len(m.MinUnit))) + i-- + dAtA[i] = 0x22 + } + if m.Scale != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.Scale)) + i-- + dAtA[i] = 0x18 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventSwapToERC20) 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 *EventSwapToERC20) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventSwapToERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ToContract) > 0 { + i -= len(m.ToContract) + copy(dAtA[i:], m.ToContract) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ToContract))) + i-- + dAtA[i] = 0x22 + } + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventSwapFromERC20) 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 *EventSwapFromERC20) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventSwapFromERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FromContract) > 0 { + i -= len(m.FromContract) + copy(dAtA[i:], m.FromContract) + i = encodeVarintEvent(dAtA, i, uint64(len(m.FromContract))) + i-- + dAtA[i] = 0x22 + } + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.WantedAmount != nil { + { + size, err := m.WantedAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { + offset -= sovEvent(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventDeployERC20) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + if m.Scale != 0 { + n += 1 + sovEvent(uint64(m.Scale)) + } + l = len(m.MinUnit) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventSwapToERC20) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovEvent(uint64(l)) + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ToContract) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventSwapFromERC20) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.WantedAmount != nil { + l = m.WantedAmount.Size() + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.FromContract) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func sovEvent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvent(x uint64) (n int) { + return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventDeployERC20) 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 ErrIntOverflowEvent + } + 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: EventDeployERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventDeployERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Scale", wireType) + } + m.Scale = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Scale |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinUnit", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinUnit = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventSwapToERC20) 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 ErrIntOverflowEvent + } + 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: EventSwapToERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventSwapToERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToContract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToContract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventSwapFromERC20) 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 ErrIntOverflowEvent + } + 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: EventSwapFromERC20: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventSwapFromERC20: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WantedAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.WantedAmount == nil { + m.WantedAmount = &types.Coin{} + } + if err := m.WantedAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromContract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromContract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvent(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, ErrIntOverflowEvent + } + 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, ErrIntOverflowEvent + } + 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, ErrIntOverflowEvent + } + 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, ErrInvalidLengthEvent + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvent + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvent + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvent = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvent = fmt.Errorf("proto: unexpected end of group") +) diff --git a/modules/token/types/v1/msgs.go b/modules/token/types/v1/msgs.go index 7166afe6..251489ca 100644 --- a/modules/token/types/v1/msgs.go +++ b/modules/token/types/v1/msgs.go @@ -1,8 +1,13 @@ package v1 import ( + fmt "fmt" + "regexp" + + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/common" tokentypes "github.com/irisnet/irismod/modules/token/types" ) @@ -29,6 +34,13 @@ var ( _ sdk.Msg = &MsgTransferTokenOwner{} _ sdk.Msg = &MsgSwapFeeToken{} _ sdk.Msg = &MsgUpdateParams{} + _ sdk.Msg = &MsgDeployERC20{} + _ sdk.Msg = &MsgSwapFromERC20{} + _ sdk.Msg = &MsgSwapToERC20{} + _ sdk.Msg = &MsgUpgradeERC20{} + + regexpERC20Fmt = fmt.Sprintf("^[a-z][a-zA-Z0-9/]{%d,%d}$", tokentypes.MinimumSymbolLen-1, 100) + regexpERC20 = regexp.MustCompile(regexpERC20Fmt).MatchString ) // NewMsgIssueToken - construct token issue msg. @@ -59,7 +71,7 @@ func (msg MsgIssueToken) Type() string { return TypeMsgIssueToken } func (msg MsgIssueToken) ValidateBasic() error { owner, err := sdk.AccAddressFromBech32(msg.Owner) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } return NewToken( @@ -124,7 +136,7 @@ func (msg MsgTransferTokenOwner) GetSigners() []sdk.AccAddress { func (msg MsgTransferTokenOwner) ValidateBasic() error { srcOwner, err := sdk.AccAddressFromBech32(msg.SrcOwner) if err != nil { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( sdkerrors.ErrInvalidAddress, "invalid source owner address (%s)", err, @@ -133,7 +145,7 @@ func (msg MsgTransferTokenOwner) ValidateBasic() error { dstOwner, err := sdk.AccAddressFromBech32(msg.DstOwner) if err != nil { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( sdkerrors.ErrInvalidAddress, "invalid destination owner address (%s)", err, @@ -204,7 +216,7 @@ func (msg MsgEditToken) GetSigners() []sdk.AccAddress { func (msg MsgEditToken) ValidateBasic() error { // check owner if _, err := sdk.AccAddressFromBech32(msg.Owner); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } if err := tokentypes.ValidateName(msg.Name); err != nil { @@ -242,13 +254,13 @@ func (msg MsgMintToken) GetSigners() []sdk.AccAddress { func (msg MsgMintToken) ValidateBasic() error { // check the owner if _, err := sdk.AccAddressFromBech32(msg.Owner); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } // check the reception - if len(msg.To) > 0 { - if _, err := sdk.AccAddressFromBech32(msg.To); err != nil { - return sdkerrors.Wrapf( + if len(msg.Receiver) > 0 { + if _, err := sdk.AccAddressFromBech32(msg.Receiver); err != nil { + return errorsmod.Wrapf( sdkerrors.ErrInvalidAddress, "invalid mint reception address (%s)", err, @@ -287,7 +299,7 @@ func (msg MsgBurnToken) GetSigners() []sdk.AccAddress { func (msg MsgBurnToken) ValidateBasic() error { // check the owner if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } return tokentypes.ValidateCoin(msg.Coin) @@ -315,12 +327,12 @@ func (msg MsgSwapFeeToken) GetSignBytes() []byte { func (msg MsgSwapFeeToken) ValidateBasic() error { // check the Sender if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } - if len(msg.Recipient) != 0 { - if _, err := sdk.AccAddressFromBech32(msg.Recipient); err != nil { - return sdkerrors.Wrapf( + if len(msg.Receiver) != 0 { + if _, err := sdk.AccAddressFromBech32(msg.Receiver); err != nil { + return errorsmod.Wrapf( sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err, @@ -341,7 +353,7 @@ func (m *MsgUpdateParams) GetSignBytes() []byte { // ValidateBasic executes sanity validation on the provided data func (m *MsgUpdateParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return sdkerrors.Wrap(err, "invalid authority address") + return errorsmod.Wrap(err, "invalid authority address") } return m.Params.Validate() } @@ -351,3 +363,114 @@ func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(m.Authority) return []sdk.AccAddress{addr} } + +// ValidateBasic implements Msg +func (m *MsgDeployERC20) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) + } + + if err := tokentypes.ValidateName(m.Name); err != nil { + return err + } + + if err := tokentypes.ValidateScale(m.Scale); err != nil { + return err + } + + if err := ValidateERC20(m.MinUnit); err != nil { + return err + } + return ValidateERC20(m.Symbol) +} + +// GetSigners returns the expected signers for a MsgDeployERC20 message +func (m *MsgDeployERC20) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic implements Msg +func (m *MsgSwapFromERC20) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + + if _, err := sdk.AccAddressFromBech32(m.Receiver); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid receiver address (%s)", err) + } + + if !m.WantedAmount.IsValid() { + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.WantedAmount.String()) + } + + if !m.WantedAmount.IsPositive() { + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.WantedAmount.String()) + } + return nil +} + +// GetSigners returns the expected signers for a MsgSwapFromERC20 message +func (m *MsgSwapFromERC20) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{addr} +} + +// ValidateBasic implements Msg +func (m *MsgSwapToERC20) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + + if !common.IsHexAddress(m.Receiver) { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "expecting a hex address, got %s", m.Receiver) + } + + if !m.Amount.IsValid() { + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) + } + + if !m.Amount.IsPositive() { + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) + } + return nil +} + +// GetSigners returns the expected signers for a MsgSwapToERC20 message +func (m *MsgSwapToERC20) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{addr} +} + +// ValidateBasic implements Msg +func (m *MsgUpgradeERC20) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) + } + + if !common.IsHexAddress(m.Implementation) { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "expecting a hex address, got %s", m.Implementation) + } + return nil +} + +// GetSigners returns the expected signers for a MsgUpgradeERC20 message +func (m *MsgUpgradeERC20) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateERC20 validates ERC20 symbol or name +func ValidateERC20(params string) error { + if !regexpERC20(params) { + return errorsmod.Wrapf( + tokentypes.ErrInvalidSymbol, + "invalid symbol or name: %s, only accepts english lowercase letters, numbers or slash, length [%d, %d], and begin with an english letter, regexp: %s", + params, + tokentypes.MinimumSymbolLen, + tokentypes.MaximumSymbolLen, + regexpERC20Fmt, + ) + } + return nil +} diff --git a/modules/token/types/v1/msgs_test.go b/modules/token/types/v1/msgs_test.go index f7dbbe06..ed208fea 100644 --- a/modules/token/types/v1/msgs_test.go +++ b/modules/token/types/v1/msgs_test.go @@ -9,6 +9,7 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + tokentypes "github.com/irisnet/irismod/modules/token/types" ) @@ -154,7 +155,7 @@ func TestMsgEditTokenRoute(t *testing.T) { func TestMsgEditTokenGetSignBytes(t *testing.T) { mintable := tokentypes.False - var msg = MsgEditToken{ + msg := MsgEditToken{ Name: "BTC TOKEN", Owner: sdk.AccAddress(tmhash.SumTruncated([]byte("owner"))).String(), Symbol: "btc", @@ -192,8 +193,8 @@ func TestMsgMintTokenValidateBasic(t *testing.T) { Denom: td.minUnit, Amount: sdkmath.NewIntFromUint64(td.amount), }, - To: td.to, - Owner: td.owner, + Receiver: td.to, + Owner: td.owner, } if td.expectPass { require.Nil(t, msg.ValidateBasic(), "test: %v", td.msg) @@ -258,3 +259,35 @@ func TestMsgTransferTokenOwnerValidation(t *testing.T) { } } } + +func TestMsgDeployERC20(t *testing.T) { + testData := []struct { + symbol string + name string + scale uint32 + minUnit string + authority string + expectPass bool + }{ + {symbol: "btc", name: "BTC TOKEN", scale: 18, minUnit: "staoshi", authority: addr1, expectPass: true}, + {symbol: "BTC", name: "BTC TOKEN", scale: 18, minUnit: "staoshi", authority: addr1, expectPass: false}, + {symbol: "bTC", name: "BTC TOKEN", scale: 18, minUnit: "staoshi", authority: addr1, expectPass: true}, + {symbol: "stake", name: "Stake Token", scale: 18, minUnit: "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9", authority: addr1, expectPass: true}, + {symbol: "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9", name: "Stake Token", scale: 18, minUnit: "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9", authority: addr1, expectPass: true}, + } + + for _, td := range testData { + msg := MsgDeployERC20{ + Symbol: td.symbol, + Name: td.name, + Scale: td.scale, + MinUnit: td.minUnit, + Authority: td.authority, + } + if td.expectPass { + require.Nil(t, msg.ValidateBasic(), "test: %v", td.name) + } else { + require.NotNil(t, msg.ValidateBasic(), "test: %v", td.name) + } + } +} diff --git a/modules/token/types/v1/params.go b/modules/token/types/v1/params.go index 8d6a1002..7cfe3d35 100644 --- a/modules/token/types/v1/params.go +++ b/modules/token/types/v1/params.go @@ -3,17 +3,22 @@ package v1 import ( "fmt" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/common" ) // NewParams constructs a new Params instance func NewParams(tokenTaxRate sdk.Dec, issueTokenBaseFee sdk.Coin, - mintTokenFeeRatio sdk.Dec, + mintTokenFeeRatio sdk.Dec, enableErc20 bool, beacon string, ) Params { return Params{ TokenTaxRate: tokenTaxRate, IssueTokenBaseFee: issueTokenBaseFee, MintTokenFeeRatio: mintTokenFeeRatio, + EnableErc20: enableErc20, + Beacon: beacon, } } @@ -24,10 +29,11 @@ func DefaultParams() Params { TokenTaxRate: sdk.NewDecWithPrec(4, 1), // 0.4 (40%) IssueTokenBaseFee: sdk.NewCoin(defaultToken.Symbol, sdk.NewInt(60000)), MintTokenFeeRatio: sdk.NewDecWithPrec(1, 1), // 0.1 (10%) + EnableErc20: true, } } -// ValidateParams validates the given params +// Validate validates the given params func (p Params) Validate() error { if err := validateTaxRate(p.TokenTaxRate); err != nil { return err @@ -38,8 +44,7 @@ func (p Params) Validate() error { if err := validateIssueTokenBaseFee(p.IssueTokenBaseFee); err != nil { return err } - - return nil + return validateBeacon(p.Beacon) } func validateTaxRate(i interface{}) error { @@ -75,3 +80,17 @@ func validateIssueTokenBaseFee(i interface{}) error { } return nil } + +func validateBeacon(i interface{}) error { + v, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + if len(v) == 0 { + return nil + } + if !common.IsHexAddress(v) { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "beacon expecting a hex address, got %s", v) + } + return nil +} diff --git a/modules/token/types/v1/query.pb.go b/modules/token/types/v1/query.pb.go index b0668a77..d9ef5019 100644 --- a/modules/token/types/v1/query.pb.go +++ b/modules/token/types/v1/query.pb.go @@ -11,6 +11,7 @@ import ( github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/types" query "github.com/cosmos/cosmos-sdk/types/query" + _ "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" @@ -509,6 +510,106 @@ func (m *QueryTotalBurnResponse) GetBurnedCoins() []types1.Coin { return nil } +// QueryBalancesRequest is request type for the Query/Balances RPC method +type QueryBalancesRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // address is the address to query balances for. + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryBalancesRequest) Reset() { *m = QueryBalancesRequest{} } +func (m *QueryBalancesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBalancesRequest) ProtoMessage() {} +func (*QueryBalancesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_47c4517e4b9aaaa2, []int{10} +} +func (m *QueryBalancesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBalancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBalancesRequest.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 *QueryBalancesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBalancesRequest.Merge(m, src) +} +func (m *QueryBalancesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBalancesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBalancesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBalancesRequest proto.InternalMessageInfo + +func (m *QueryBalancesRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *QueryBalancesRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +// QueryBalancesResponse is response type for the Query/Balances RPC method +type QueryBalancesResponse struct { + // balances is the balances of all the coins. + Balances github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=balances,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balances"` +} + +func (m *QueryBalancesResponse) Reset() { *m = QueryBalancesResponse{} } +func (m *QueryBalancesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBalancesResponse) ProtoMessage() {} +func (*QueryBalancesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_47c4517e4b9aaaa2, []int{11} +} +func (m *QueryBalancesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBalancesResponse.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 *QueryBalancesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBalancesResponse.Merge(m, src) +} +func (m *QueryBalancesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBalancesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBalancesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBalancesResponse proto.InternalMessageInfo + +func (m *QueryBalancesResponse) GetBalances() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Balances + } + return nil +} + func init() { proto.RegisterType((*QueryTokenRequest)(nil), "irismod.token.v1.QueryTokenRequest") proto.RegisterType((*QueryTokenResponse)(nil), "irismod.token.v1.QueryTokenResponse") @@ -520,61 +621,71 @@ func init() { proto.RegisterType((*QueryParamsResponse)(nil), "irismod.token.v1.QueryParamsResponse") proto.RegisterType((*QueryTotalBurnRequest)(nil), "irismod.token.v1.QueryTotalBurnRequest") proto.RegisterType((*QueryTotalBurnResponse)(nil), "irismod.token.v1.QueryTotalBurnResponse") + proto.RegisterType((*QueryBalancesRequest)(nil), "irismod.token.v1.QueryBalancesRequest") + proto.RegisterType((*QueryBalancesResponse)(nil), "irismod.token.v1.QueryBalancesResponse") } func init() { proto.RegisterFile("irismod/token/v1/query.proto", fileDescriptor_47c4517e4b9aaaa2) } var fileDescriptor_47c4517e4b9aaaa2 = []byte{ - // 781 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x4f, 0x13, 0x4d, - 0x18, 0xee, 0x02, 0xed, 0x57, 0x06, 0x0e, 0x7c, 0xf3, 0xf5, 0xc3, 0xb2, 0x92, 0x85, 0x2c, 0xf2, - 0x33, 0x61, 0x27, 0x85, 0xc4, 0xa8, 0x37, 0x4b, 0x52, 0x63, 0x4c, 0x0c, 0x6e, 0x3c, 0x19, 0x93, - 0x66, 0x4b, 0x87, 0x75, 0x43, 0x77, 0xa6, 0xec, 0xcc, 0xa2, 0x8d, 0x70, 0xd0, 0x78, 0xc0, 0x9b, - 0x89, 0x37, 0xfe, 0x0a, 0x0f, 0xfe, 0x11, 0xc4, 0x13, 0x89, 0x17, 0x4f, 0xc4, 0x80, 0x89, 0x7f, - 0x83, 0x9e, 0xcc, 0xfc, 0xd8, 0x76, 0x0b, 0xb4, 0xd5, 0xc4, 0x13, 0xbc, 0xf3, 0xbe, 0xef, 0xf3, - 0x3c, 0xf3, 0xec, 0xfb, 0x4e, 0xc1, 0x74, 0x10, 0x05, 0x2c, 0xa4, 0x75, 0xc4, 0xe9, 0x0e, 0x26, - 0x68, 0xaf, 0x84, 0x76, 0x63, 0x1c, 0xb5, 0x9c, 0x66, 0x44, 0x39, 0x85, 0x13, 0x3a, 0xeb, 0xc8, - 0xac, 0xb3, 0x57, 0x32, 0xad, 0x2d, 0xca, 0x42, 0xca, 0x50, 0xcd, 0x63, 0x18, 0xed, 0x95, 0x6a, - 0x98, 0x7b, 0x25, 0xb4, 0x45, 0x03, 0xa2, 0x3a, 0xcc, 0x29, 0x95, 0xaf, 0xca, 0x08, 0xa9, 0x40, - 0xa7, 0x56, 0xd2, 0xad, 0x92, 0xa5, 0x0d, 0xd0, 0xf4, 0xfc, 0x80, 0x78, 0x3c, 0xa0, 0x09, 0xcc, - 0x75, 0x5d, 0x9b, 0x94, 0xa5, 0x55, 0x99, 0x05, 0x9f, 0xfa, 0x54, 0x11, 0x88, 0xff, 0xf4, 0xe9, - 0xb4, 0x4f, 0xa9, 0xdf, 0xc0, 0xc8, 0x6b, 0x06, 0xc8, 0x23, 0x84, 0x72, 0x89, 0x97, 0x90, 0x4f, - 0xe9, 0xac, 0x8c, 0x6a, 0xf1, 0x36, 0xf2, 0x48, 0x02, 0x77, 0xd9, 0x02, 0x75, 0x5b, 0x99, 0xb5, - 0x97, 0xc1, 0xbf, 0x8f, 0x04, 0xf7, 0x63, 0x71, 0xe6, 0xe2, 0xdd, 0x18, 0x33, 0x0e, 0x0b, 0x20, - 0x5b, 0xc7, 0x84, 0x86, 0x45, 0x63, 0xd6, 0x58, 0x1a, 0x75, 0x55, 0x60, 0x3f, 0x04, 0x30, 0x5d, - 0xca, 0x9a, 0x94, 0x30, 0x0c, 0x6f, 0x81, 0xac, 0xc4, 0x93, 0xb5, 0x63, 0x6b, 0x05, 0x47, 0x29, - 0x71, 0x12, 0x25, 0xce, 0x5d, 0xd2, 0x2a, 0x8f, 0x7f, 0xfa, 0xb8, 0x9a, 0xdf, 0xa0, 0x84, 0x63, - 0xc2, 0xef, 0xbb, 0xaa, 0xc1, 0x8e, 0xd2, 0x78, 0x2c, 0xc5, 0x4d, 0x9f, 0x13, 0x1c, 0x25, 0xdc, - 0x32, 0x80, 0x15, 0x00, 0x3a, 0x26, 0x16, 0x87, 0x24, 0xd5, 0x82, 0xa3, 0xfd, 0x17, 0x8e, 0x3b, - 0xca, 0x41, 0xed, 0xb8, 0xb3, 0xe9, 0xf9, 0x58, 0x23, 0xba, 0xa9, 0x4e, 0xfb, 0xc8, 0x00, 0xff, - 0x75, 0x91, 0xea, 0x5b, 0xdc, 0x01, 0x39, 0x29, 0x8a, 0x15, 0x8d, 0xd9, 0xe1, 0xdf, 0xbc, 0x86, - 0xee, 0x80, 0xf7, 0xae, 0xd0, 0xb6, 0x38, 0x50, 0x9b, 0x22, 0xee, 0x12, 0xb7, 0x02, 0x26, 0xa4, - 0xb6, 0x0a, 0xc6, 0x6d, 0x3b, 0x26, 0x41, 0x8e, 0xb5, 0xc2, 0x1a, 0x6d, 0x68, 0x3f, 0x74, 0x64, - 0xff, 0x30, 0xf4, 0x87, 0x53, 0xc5, 0xfa, 0x1a, 0x05, 0x90, 0xc5, 0x2f, 0x02, 0xc6, 0x65, 0x71, - 0xde, 0x55, 0x01, 0xf4, 0xc1, 0x68, 0xc0, 0x58, 0x8c, 0xab, 0xdb, 0x18, 0x6b, 0x7d, 0x53, 0x5d, - 0xfa, 0x12, 0x65, 0x1b, 0x34, 0x20, 0x65, 0x74, 0x7c, 0x3a, 0x93, 0xf9, 0x79, 0x3a, 0xb3, 0xe8, - 0x07, 0xfc, 0x59, 0x5c, 0x73, 0xb6, 0x68, 0xa8, 0x07, 0x5d, 0xff, 0x59, 0x65, 0xf5, 0x1d, 0xc4, - 0x5b, 0x4d, 0xcc, 0x64, 0x83, 0x9b, 0x97, 0xe0, 0x15, 0x8c, 0x21, 0x06, 0xf9, 0x30, 0x20, 0x5c, - 0xf2, 0x0c, 0xff, 0x75, 0x9e, 0x7f, 0x04, 0x76, 0x05, 0x63, 0xbb, 0xa0, 0x07, 0x67, 0xd3, 0x8b, - 0xbc, 0x30, 0x71, 0xca, 0x3e, 0x4c, 0x3e, 0x6d, 0x72, 0xac, 0x3d, 0xb9, 0x09, 0x72, 0x4d, 0x79, - 0xa2, 0x27, 0xb4, 0xe8, 0x5c, 0xdc, 0x7a, 0x47, 0x75, 0x94, 0x47, 0x84, 0x22, 0x57, 0x57, 0xc3, - 0xdb, 0x60, 0x38, 0xc2, 0xec, 0x4f, 0xbf, 0xa7, 0xe8, 0xb1, 0xaf, 0x81, 0xff, 0xf5, 0x90, 0x71, - 0xaf, 0x51, 0x8e, 0xa3, 0x64, 0xb1, 0xec, 0xa7, 0x60, 0xf2, 0x62, 0x42, 0xab, 0x2c, 0x83, 0xf1, - 0x5a, 0x1c, 0x11, 0x5c, 0xaf, 0x8a, 0xd7, 0x26, 0x19, 0xc3, 0x3e, 0xf6, 0x29, 0xb1, 0x63, 0xaa, - 0x49, 0x9c, 0xb0, 0xb5, 0xa3, 0x2c, 0xc8, 0x4a, 0x78, 0xf8, 0xca, 0x00, 0x59, 0x39, 0xe1, 0x70, - 0xee, 0xf2, 0x6d, 0x2f, 0xed, 0xbb, 0x79, 0xa3, 0x7f, 0x91, 0x92, 0x68, 0xaf, 0x1e, 0x7e, 0xff, - 0xb0, 0x62, 0xbc, 0xfe, 0xfc, 0xed, 0xfd, 0x90, 0x0d, 0x67, 0xd1, 0xd5, 0xcf, 0x0a, 0x43, 0x2f, - 0xe5, 0x6b, 0x71, 0x00, 0xf7, 0x41, 0x4e, 0x2d, 0x19, 0xec, 0x0b, 0x9f, 0x7c, 0x3f, 0x73, 0x7e, - 0x40, 0x95, 0x56, 0x31, 0xdf, 0x51, 0x61, 0xc2, 0x62, 0x2f, 0x15, 0xf0, 0x8d, 0x01, 0x46, 0xc4, - 0x6a, 0x40, 0xbb, 0x07, 0x6c, 0x6a, 0xc9, 0xcc, 0xb9, 0xbe, 0x35, 0x9a, 0x78, 0xbd, 0x43, 0xbc, - 0x04, 0x17, 0x7a, 0x5f, 0x5f, 0x2d, 0xe8, 0x01, 0xda, 0x16, 0xec, 0xfb, 0x20, 0xa7, 0x86, 0xab, - 0xa7, 0x09, 0x5d, 0x43, 0xdc, 0xd3, 0x84, 0xee, 0x99, 0x1e, 0x68, 0x82, 0x1e, 0xe1, 0xb7, 0x06, - 0x18, 0x6d, 0x8f, 0x1a, 0x5c, 0xec, 0x69, 0x70, 0xf7, 0x94, 0x9a, 0x4b, 0x83, 0x0b, 0xb5, 0x8e, - 0xe5, 0x8e, 0x0e, 0x0b, 0x4e, 0x5f, 0xe5, 0x09, 0xf7, 0x1a, 0x55, 0x31, 0xa3, 0xe5, 0x07, 0xc7, - 0x67, 0x96, 0x71, 0x72, 0x66, 0x19, 0x5f, 0xcf, 0x2c, 0xe3, 0xdd, 0xb9, 0x95, 0x39, 0x39, 0xb7, - 0x32, 0x5f, 0xce, 0xad, 0xcc, 0x93, 0x52, 0xea, 0x01, 0x10, 0x08, 0x04, 0xf3, 0x36, 0x52, 0x48, - 0xeb, 0x71, 0x03, 0x33, 0x8d, 0x28, 0x1f, 0x03, 0xf1, 0xab, 0x9a, 0x93, 0xcf, 0xf2, 0xfa, 0xaf, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x97, 0x3a, 0xa9, 0x33, 0xdf, 0x07, 0x00, 0x00, + // 911 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0x36, 0xb5, 0xeb, 0x4c, 0x7b, 0x68, 0x07, 0x53, 0x9c, 0x25, 0xda, 0x54, 0x9b, 0xe6, + 0x47, 0x2d, 0x65, 0x07, 0xa7, 0x02, 0x01, 0x82, 0x43, 0xb7, 0x52, 0x10, 0x42, 0x42, 0x65, 0xe1, + 0x84, 0x90, 0xc2, 0x38, 0x9e, 0x2c, 0xab, 0x7a, 0x67, 0xdc, 0x9d, 0xd9, 0x40, 0xd4, 0xe6, 0x82, + 0x40, 0x2a, 0x37, 0x24, 0x4e, 0xf0, 0x17, 0x20, 0x4e, 0x1c, 0x7a, 0xe1, 0x3f, 0xa8, 0x38, 0x55, + 0x70, 0xe1, 0x54, 0x50, 0x82, 0xc4, 0xdf, 0x00, 0x27, 0x34, 0x33, 0x6f, 0xec, 0x75, 0x12, 0xdb, + 0x45, 0xe2, 0x92, 0x78, 0xe6, 0xbd, 0xf7, 0x7d, 0xdf, 0xbc, 0x37, 0xdf, 0xd8, 0x68, 0x29, 0x2b, + 0x32, 0x99, 0x8b, 0x1e, 0x51, 0xe2, 0x2e, 0xe3, 0x64, 0xbf, 0x43, 0xee, 0x95, 0xac, 0x38, 0x88, + 0x06, 0x85, 0x50, 0x02, 0x5f, 0x86, 0x68, 0x64, 0xa2, 0xd1, 0x7e, 0xc7, 0x0f, 0x76, 0x85, 0xcc, + 0x85, 0x24, 0x5d, 0x2a, 0x19, 0xd9, 0xef, 0x74, 0x99, 0xa2, 0x1d, 0xb2, 0x2b, 0x32, 0x6e, 0x2b, + 0xfc, 0x45, 0x1b, 0xdf, 0x31, 0x2b, 0x62, 0x17, 0x10, 0x6a, 0x57, 0x4b, 0x0d, 0xcb, 0x10, 0x60, + 0x40, 0xd3, 0x8c, 0x53, 0x95, 0x09, 0x07, 0xf3, 0x22, 0xe4, 0xba, 0xb4, 0xaa, 0x2a, 0xbf, 0x99, + 0x8a, 0x54, 0x58, 0x02, 0xfd, 0x09, 0x76, 0x97, 0x52, 0x21, 0xd2, 0x3e, 0x23, 0x74, 0x90, 0x11, + 0xca, 0xb9, 0x50, 0x06, 0xcf, 0x91, 0x2f, 0x42, 0xd4, 0xac, 0xba, 0xe5, 0x1e, 0xa1, 0xdc, 0xc1, + 0x5d, 0xa1, 0x79, 0xc6, 0x05, 0x31, 0x7f, 0x1d, 0xd6, 0xa9, 0xae, 0xd8, 0x06, 0x98, 0x68, 0x78, + 0x03, 0x5d, 0x79, 0x4f, 0xcb, 0xf9, 0x40, 0xef, 0x25, 0xec, 0x5e, 0xc9, 0xa4, 0xc2, 0x4d, 0x54, + 0xeb, 0x31, 0x2e, 0xf2, 0x96, 0x77, 0xcd, 0xdb, 0x58, 0x48, 0xec, 0x22, 0x7c, 0x17, 0xe1, 0x6a, + 0xaa, 0x1c, 0x08, 0x2e, 0x19, 0x7e, 0x15, 0xd5, 0x0c, 0x9e, 0xc9, 0xbd, 0xb8, 0xd5, 0x8c, 0xac, + 0xb8, 0xc8, 0x89, 0x8b, 0x6e, 0xf1, 0x83, 0xf8, 0xd2, 0xcf, 0x8f, 0x36, 0x1b, 0xb7, 0x05, 0x57, + 0x8c, 0xab, 0xb7, 0x13, 0x5b, 0x10, 0x16, 0x55, 0x3c, 0x59, 0xe1, 0x16, 0x9f, 0x72, 0x56, 0x38, + 0x6e, 0xb3, 0xc0, 0xdb, 0x08, 0x8d, 0xfa, 0xda, 0x3a, 0x67, 0xa8, 0xd6, 0x22, 0x18, 0x89, 0x1e, + 0x42, 0x64, 0x9b, 0x0a, 0x43, 0x88, 0xee, 0xd0, 0x94, 0x01, 0x62, 0x52, 0xa9, 0x0c, 0xbf, 0xf3, + 0xd0, 0x73, 0x63, 0xa4, 0x70, 0x8a, 0xd7, 0x51, 0xdd, 0x88, 0x92, 0x2d, 0xef, 0xda, 0xfc, 0x33, + 0x1e, 0x03, 0x2a, 0xf0, 0x5b, 0x67, 0x68, 0x5b, 0x9f, 0xa9, 0xcd, 0x12, 0x8f, 0x89, 0x6b, 0xa3, + 0xcb, 0x46, 0xdb, 0x36, 0x63, 0xc3, 0x76, 0x5c, 0x45, 0x75, 0x79, 0x90, 0x77, 0x45, 0x1f, 0xfa, + 0x01, 0xab, 0xf0, 0x6f, 0x0f, 0x06, 0x67, 0x93, 0xe1, 0x18, 0x4d, 0x54, 0x63, 0x9f, 0x65, 0x52, + 0x99, 0xe4, 0x46, 0x62, 0x17, 0x38, 0x45, 0x0b, 0x99, 0x94, 0x25, 0xdb, 0xd9, 0x63, 0x0c, 0xf4, + 0x2d, 0x8e, 0xe9, 0x73, 0xca, 0x6e, 0x8b, 0x8c, 0xc7, 0xe4, 0xf1, 0xd3, 0xe5, 0xb9, 0x7f, 0x9e, + 0x2e, 0xaf, 0xa7, 0x99, 0xfa, 0xa4, 0xec, 0x46, 0xbb, 0x22, 0x87, 0xbb, 0x0f, 0xff, 0x36, 0x65, + 0xef, 0x2e, 0x51, 0x07, 0x03, 0x26, 0x4d, 0x41, 0xd2, 0x30, 0xe0, 0xdb, 0x8c, 0x61, 0x86, 0x1a, + 0x79, 0xc6, 0x95, 0xe1, 0x99, 0xff, 0xdf, 0x79, 0x2e, 0x68, 0xec, 0x6d, 0xc6, 0xc2, 0x26, 0x5c, + 0x9c, 0x3b, 0xb4, 0xa0, 0xb9, 0xeb, 0x54, 0xf8, 0xd0, 0x8d, 0xd6, 0x6d, 0x43, 0x4f, 0x5e, 0x41, + 0xf5, 0x81, 0xd9, 0x81, 0x1b, 0xda, 0x8a, 0x4e, 0x3e, 0x04, 0x91, 0xad, 0x88, 0xcf, 0x6b, 0x45, + 0x09, 0x64, 0xe3, 0xd7, 0xd0, 0x7c, 0xc1, 0xe4, 0x7f, 0x9d, 0xa7, 0xae, 0x09, 0x5f, 0x40, 0xcf, + 0xc3, 0x25, 0x53, 0xb4, 0x1f, 0x97, 0x85, 0x33, 0x56, 0xf8, 0x11, 0xba, 0x7a, 0x32, 0x00, 0x2a, + 0x63, 0x74, 0xa9, 0x5b, 0x16, 0x9c, 0xf5, 0x76, 0xf4, 0x03, 0xe4, 0xae, 0xe1, 0x94, 0xf6, 0x59, + 0xb1, 0x17, 0x6d, 0x91, 0xde, 0x91, 0xe1, 0xc7, 0xa8, 0x69, 0xd0, 0x63, 0xda, 0xa7, 0x7c, 0x97, + 0xc9, 0xa9, 0x76, 0xc6, 0x5b, 0xe8, 0x02, 0xed, 0xf5, 0x0a, 0x26, 0xed, 0x19, 0x17, 0xe2, 0xd6, + 0x2f, 0x8f, 0x36, 0x9b, 0xc0, 0x77, 0xcb, 0x46, 0xde, 0x57, 0x45, 0xc6, 0xd3, 0xc4, 0x25, 0x86, + 0x5f, 0x7a, 0x70, 0xb2, 0x11, 0x05, 0xe8, 0xef, 0xa3, 0x46, 0x17, 0xf6, 0x66, 0x6b, 0x7f, 0x59, + 0x6b, 0xff, 0xe1, 0xf7, 0xe5, 0x8d, 0x67, 0x1c, 0xbd, 0xfc, 0xfe, 0xaf, 0x1f, 0xdb, 0x5e, 0x32, + 0x64, 0xd8, 0xfa, 0xa9, 0x8e, 0x6a, 0x46, 0x07, 0x7e, 0x80, 0xea, 0xd6, 0xca, 0xf8, 0xfa, 0xe9, + 0xb9, 0x9e, 0x7e, 0x5e, 0xfc, 0xd5, 0x19, 0x59, 0xf6, 0x38, 0xe1, 0xea, 0x43, 0xcd, 0xf8, 0xf9, + 0xaf, 0x7f, 0x7e, 0x73, 0xce, 0xc7, 0x2d, 0x72, 0xf6, 0x13, 0x2a, 0xf1, 0x17, 0x1e, 0xaa, 0x99, + 0x4a, 0xbc, 0x32, 0x0d, 0xd7, 0x91, 0x5f, 0x9f, 0x9e, 0x04, 0xdc, 0x2f, 0x8d, 0xb8, 0x57, 0xf1, + 0xca, 0x24, 0x6e, 0x72, 0xdf, 0x8c, 0xf1, 0xcd, 0x76, 0xfb, 0x50, 0xcb, 0x38, 0xaf, 0xdf, 0x01, + 0x1c, 0x4e, 0x20, 0xa8, 0xbc, 0x28, 0xfe, 0xca, 0xd4, 0x1c, 0xd0, 0x70, 0x73, 0xa4, 0x61, 0x03, + 0xaf, 0x4d, 0xd6, 0x60, 0x5f, 0xa3, 0x43, 0xb2, 0xa7, 0xd9, 0x1f, 0xa0, 0xba, 0x75, 0xd2, 0xc4, + 0x59, 0x8c, 0x39, 0x76, 0xe2, 0x2c, 0xc6, 0x0d, 0x3c, 0x73, 0x16, 0xe0, 0xd7, 0xaf, 0x3c, 0xb4, + 0x30, 0xf4, 0x15, 0x5e, 0x9f, 0xd8, 0xea, 0x71, 0x4b, 0xfa, 0x1b, 0xb3, 0x13, 0x41, 0xc7, 0x8d, + 0x91, 0x8e, 0x00, 0x2f, 0x9d, 0xd5, 0x13, 0x45, 0xfb, 0x3b, 0xda, 0x90, 0xf8, 0x5b, 0x0f, 0x35, + 0x9c, 0x45, 0xf0, 0xda, 0x04, 0x86, 0x13, 0x36, 0xf5, 0xd7, 0x67, 0xe6, 0x81, 0x90, 0x37, 0x46, + 0x42, 0x3a, 0x98, 0x9c, 0x16, 0xe2, 0x6c, 0x42, 0xee, 0x83, 0x6f, 0x0f, 0x2b, 0x97, 0x25, 0x7e, + 0xe7, 0xf1, 0x51, 0xe0, 0x3d, 0x39, 0x0a, 0xbc, 0x3f, 0x8e, 0x02, 0xef, 0xeb, 0xe3, 0x60, 0xee, + 0xc9, 0x71, 0x30, 0xf7, 0xdb, 0x71, 0x30, 0xf7, 0x61, 0xa7, 0x62, 0x47, 0x0d, 0xca, 0x99, 0x1a, + 0x82, 0xe7, 0xa2, 0x57, 0xf6, 0x99, 0x04, 0x12, 0x63, 0x4d, 0xfd, 0x8b, 0xa7, 0x6e, 0xbe, 0x1f, + 0x6f, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x0c, 0x39, 0x80, 0x7b, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -589,16 +700,19 @@ 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 QueryClient interface { - // Token returns token with token name - Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) // Tokens returns the token list Tokens(ctx context.Context, in *QueryTokensRequest, opts ...grpc.CallOption) (*QueryTokensResponse, error) + // Token returns token with token name + Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) // Fees returns the fees to issue or mint a token Fees(ctx context.Context, in *QueryFeesRequest, opts ...grpc.CallOption) (*QueryFeesResponse, error) // Params queries the token parameters Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // TotalBurn queries all the burnt coins TotalBurn(ctx context.Context, in *QueryTotalBurnRequest, opts ...grpc.CallOption) (*QueryTotalBurnResponse, error) + // Balances queries the balance of the specified token (including erc20 + // balance) + Balances(ctx context.Context, in *QueryBalancesRequest, opts ...grpc.CallOption) (*QueryBalancesResponse, error) } type queryClient struct { @@ -609,18 +723,18 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) { - out := new(QueryTokenResponse) - err := c.cc.Invoke(ctx, "/irismod.token.v1.Query/Token", in, out, opts...) +func (c *queryClient) Tokens(ctx context.Context, in *QueryTokensRequest, opts ...grpc.CallOption) (*QueryTokensResponse, error) { + out := new(QueryTokensResponse) + err := c.cc.Invoke(ctx, "/irismod.token.v1.Query/Tokens", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) Tokens(ctx context.Context, in *QueryTokensRequest, opts ...grpc.CallOption) (*QueryTokensResponse, error) { - out := new(QueryTokensResponse) - err := c.cc.Invoke(ctx, "/irismod.token.v1.Query/Tokens", in, out, opts...) +func (c *queryClient) Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) { + out := new(QueryTokenResponse) + err := c.cc.Invoke(ctx, "/irismod.token.v1.Query/Token", in, out, opts...) if err != nil { return nil, err } @@ -654,30 +768,42 @@ func (c *queryClient) TotalBurn(ctx context.Context, in *QueryTotalBurnRequest, return out, nil } +func (c *queryClient) Balances(ctx context.Context, in *QueryBalancesRequest, opts ...grpc.CallOption) (*QueryBalancesResponse, error) { + out := new(QueryBalancesResponse) + err := c.cc.Invoke(ctx, "/irismod.token.v1.Query/Balances", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { - // Token returns token with token name - Token(context.Context, *QueryTokenRequest) (*QueryTokenResponse, error) // Tokens returns the token list Tokens(context.Context, *QueryTokensRequest) (*QueryTokensResponse, error) + // Token returns token with token name + Token(context.Context, *QueryTokenRequest) (*QueryTokenResponse, error) // Fees returns the fees to issue or mint a token Fees(context.Context, *QueryFeesRequest) (*QueryFeesResponse, error) // Params queries the token parameters Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // TotalBurn queries all the burnt coins TotalBurn(context.Context, *QueryTotalBurnRequest) (*QueryTotalBurnResponse, error) + // Balances queries the balance of the specified token (including erc20 + // balance) + Balances(context.Context, *QueryBalancesRequest) (*QueryBalancesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Token(ctx context.Context, req *QueryTokenRequest) (*QueryTokenResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Token not implemented") -} func (*UnimplementedQueryServer) Tokens(ctx context.Context, req *QueryTokensRequest) (*QueryTokensResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Tokens not implemented") } +func (*UnimplementedQueryServer) Token(ctx context.Context, req *QueryTokenRequest) (*QueryTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Token not implemented") +} func (*UnimplementedQueryServer) Fees(ctx context.Context, req *QueryFeesRequest) (*QueryFeesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Fees not implemented") } @@ -687,43 +813,46 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq func (*UnimplementedQueryServer) TotalBurn(ctx context.Context, req *QueryTotalBurnRequest) (*QueryTotalBurnResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TotalBurn not implemented") } +func (*UnimplementedQueryServer) Balances(ctx context.Context, req *QueryBalancesRequest) (*QueryBalancesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Balances not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Token_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTokenRequest) +func _Query_Tokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokensRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Token(ctx, in) + return srv.(QueryServer).Tokens(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.token.v1.Query/Token", + FullMethod: "/irismod.token.v1.Query/Tokens", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Token(ctx, req.(*QueryTokenRequest)) + return srv.(QueryServer).Tokens(ctx, req.(*QueryTokensRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_Tokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTokensRequest) +func _Query_Token_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Tokens(ctx, in) + return srv.(QueryServer).Token(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.token.v1.Query/Tokens", + FullMethod: "/irismod.token.v1.Query/Token", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Tokens(ctx, req.(*QueryTokensRequest)) + return srv.(QueryServer).Token(ctx, req.(*QueryTokenRequest)) } return interceptor(ctx, in, info, handler) } @@ -782,18 +911,36 @@ func _Query_TotalBurn_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Query_Balances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBalancesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Balances(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.token.v1.Query/Balances", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Balances(ctx, req.(*QueryBalancesRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "irismod.token.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Token", - Handler: _Query_Token_Handler, - }, { MethodName: "Tokens", Handler: _Query_Tokens_Handler, }, + { + MethodName: "Token", + Handler: _Query_Token_Handler, + }, { MethodName: "Fees", Handler: _Query_Fees_Handler, @@ -806,6 +953,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "TotalBurn", Handler: _Query_TotalBurn_Handler, }, + { + MethodName: "Balances", + Handler: _Query_Balances_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "irismod/token/v1/query.proto", @@ -1178,6 +1329,80 @@ func (m *QueryTotalBurnResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *QueryBalancesRequest) 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 *QueryBalancesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBalancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBalancesResponse) 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 *QueryBalancesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBalancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balances) > 0 { + for iNdEx := len(m.Balances) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Balances[iNdEx].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 @@ -1328,6 +1553,38 @@ func (m *QueryTotalBurnResponse) Size() (n int) { return n } +func (m *QueryBalancesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBalancesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Balances) > 0 { + for _, e := range m.Balances { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2261,6 +2518,204 @@ func (m *QueryTotalBurnResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryBalancesRequest) 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: QueryBalancesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBalancesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + 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 (m *QueryBalancesResponse) 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: QueryBalancesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBalancesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balances", 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 + } + m.Balances = append(m.Balances, types1.Coin{}) + if err := m.Balances[len(m.Balances)-1].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 diff --git a/modules/token/types/v1/query.pb.gw.go b/modules/token/types/v1/query.pb.gw.go index 62e0cc74..a282d0c5 100644 --- a/modules/token/types/v1/query.pb.gw.go +++ b/modules/token/types/v1/query.pb.gw.go @@ -33,6 +33,42 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join +var ( + filter_Query_Tokens_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Tokens_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokensRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Tokens_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Tokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Tokens_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokensRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Tokens_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Tokens(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_Token_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryTokenRequest var metadata runtime.ServerMetadata @@ -87,42 +123,6 @@ func local_request_Query_Token_0(ctx context.Context, marshaler runtime.Marshale } -var ( - filter_Query_Tokens_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_Tokens_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTokensRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Tokens_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Tokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Tokens_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTokensRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Tokens_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Tokens(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_Fees_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryFeesRequest var metadata runtime.ServerMetadata @@ -213,13 +213,89 @@ func local_request_Query_TotalBurn_0(ctx context.Context, marshaler runtime.Mars } +func request_Query_Balances_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBalancesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := client.Balances(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Balances_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBalancesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.Balances(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_Token_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Tokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -230,7 +306,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Token_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Tokens_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 { @@ -238,11 +314,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Token_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Tokens_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Tokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Token_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -253,7 +329,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Tokens_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Token_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 { @@ -261,7 +337,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Tokens_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Token_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -334,6 +410,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_Balances_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_Balances_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_Balances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -375,7 +474,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Token_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Tokens_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) @@ -384,18 +483,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Token_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_Tokens_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_Token_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Tokens_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Tokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Token_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) @@ -404,14 +503,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Tokens_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_Token_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_Tokens_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Token_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -475,29 +574,53 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_Balances_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_Balances_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_Balances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( - pattern_Query_Token_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "token", "v1", "tokens", "denom"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Tokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"irismod", "token", "v1", "tokens"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Token_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 3, 0, 4, 1, 5, 4}, []string{"irismod", "token", "v1", "tokens", "denom"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Fees_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"irismod", "token", "v1", "tokens", "symbol", "fees"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"irismod", "token", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_TotalBurn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"irismod", "token", "v1", "total_burn"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Balances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 3, 0, 4, 1, 5, 5}, []string{"irismod", "token", "v1", "balances", "address", "denom"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_Token_0 = runtime.ForwardResponseMessage - forward_Query_Tokens_0 = runtime.ForwardResponseMessage + forward_Query_Token_0 = runtime.ForwardResponseMessage + forward_Query_Fees_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage forward_Query_TotalBurn_0 = runtime.ForwardResponseMessage + + forward_Query_Balances_0 = runtime.ForwardResponseMessage ) diff --git a/modules/token/types/v1/token.go b/modules/token/types/v1/token.go index a98c6505..35361b5b 100644 --- a/modules/token/types/v1/token.go +++ b/modules/token/types/v1/token.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/gogoproto/proto" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -32,6 +33,7 @@ type TokenI interface { GetMaxSupply() uint64 GetMintable() bool GetOwner() sdk.AccAddress + GetContract() string ToMainCoin(coin sdk.Coin) (sdk.DecCoin, error) ToMinCoin(coin sdk.DecCoin) (sdk.Coin, error) @@ -109,13 +111,17 @@ func (t Token) GetOwner() sdk.AccAddress { return owner } +func (t Token) GetContract() string { + return t.Contract +} + // ToMainCoin returns the main denom coin from args func (t Token) ToMainCoin(coin sdk.Coin) (sdk.DecCoin, error) { if t.MinUnit != coin.Denom { return sdk.NewDecCoinFromDec( coin.Denom, sdk.ZeroDec(), - ), sdkerrors.Wrapf( + ), errorsmod.Wrapf( tokentypes.ErrTokenNotExists, "not the token min_unit", ) @@ -133,7 +139,7 @@ func (t Token) ToMinCoin(coin sdk.DecCoin) (newCoin sdk.Coin, err error) { return sdk.NewCoin( coin.Denom, sdk.ZeroInt(), - ), sdkerrors.Wrapf( + ), errorsmod.Wrapf( tokentypes.ErrTokenNotExists, "not the token symbol", ) @@ -149,7 +155,7 @@ func (t Token) ToMinCoin(coin sdk.DecCoin) (newCoin sdk.Coin, err error) { func (t Token) Validate() error { if len(t.Owner) > 0 { if _, err := sdk.AccAddressFromBech32(t.Owner); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } } if err := tokentypes.ValidateName(t.Name); err != nil { @@ -165,7 +171,7 @@ func (t Token) Validate() error { return err } if t.MaxSupply < t.InitialSupply { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( tokentypes.ErrInvalidMaxSupply, "invalid token max supply %d, only accepts value [%d, %d]", t.MaxSupply, diff --git a/modules/token/types/v1/token.pb.go b/modules/token/types/v1/token.pb.go index 2a28d5f5..bf08409e 100644 --- a/modules/token/types/v1/token.pb.go +++ b/modules/token/types/v1/token.pb.go @@ -35,6 +35,7 @@ type Token struct { MaxSupply uint64 `protobuf:"varint,6,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty"` Mintable bool `protobuf:"varint,7,opt,name=mintable,proto3" json:"mintable,omitempty"` Owner string `protobuf:"bytes,8,opt,name=owner,proto3" json:"owner,omitempty"` + Contract string `protobuf:"bytes,9,opt,name=contract,proto3" json:"contract,omitempty"` } func (m *Token) Reset() { *m = Token{} } @@ -75,6 +76,8 @@ type Params struct { TokenTaxRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=token_tax_rate,json=tokenTaxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"token_tax_rate"` IssueTokenBaseFee types.Coin `protobuf:"bytes,2,opt,name=issue_token_base_fee,json=issueTokenBaseFee,proto3" json:"issue_token_base_fee"` MintTokenFeeRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=mint_token_fee_ratio,json=mintTokenFeeRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"mint_token_fee_ratio"` + EnableErc20 bool `protobuf:"varint,4,opt,name=enable_erc20,json=enableErc20,proto3" json:"enable_erc20,omitempty"` + Beacon string `protobuf:"bytes,5,opt,name=beacon,proto3" json:"beacon,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -118,37 +121,39 @@ func init() { func init() { proto.RegisterFile("irismod/token/v1/token.proto", fileDescriptor_c5b3436d30fd508a) } var fileDescriptor_c5b3436d30fd508a = []byte{ - // 467 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xbd, 0x6e, 0x13, 0x41, - 0x10, 0xc7, 0x6f, 0xc3, 0xd9, 0x71, 0x16, 0x12, 0x91, 0x95, 0x85, 0x2e, 0x16, 0x9c, 0xad, 0x48, - 0x20, 0x37, 0xdc, 0xe9, 0xa0, 0x4b, 0x69, 0x50, 0x5a, 0xa2, 0xc3, 0x34, 0x34, 0xa7, 0xbd, 0xf3, - 0xc4, 0xac, 0x72, 0xbb, 0x6b, 0xdd, 0xee, 0x19, 0xfb, 0x0d, 0x28, 0xe9, 0x68, 0xf3, 0x38, 0x2e, - 0x53, 0x22, 0x8a, 0x08, 0xec, 0x86, 0xc7, 0x40, 0xfb, 0x61, 0x44, 0x4b, 0xb5, 0x33, 0xff, 0x9d, - 0xfd, 0xcd, 0xec, 0xcc, 0xe0, 0xa7, 0xac, 0x61, 0x8a, 0xcb, 0x59, 0xaa, 0xe5, 0x0d, 0x88, 0x74, - 0x99, 0x39, 0x23, 0x59, 0x34, 0x52, 0x4b, 0xf2, 0xd8, 0xdf, 0x26, 0x4e, 0x5c, 0x66, 0x83, 0xb8, - 0x92, 0x8a, 0x4b, 0x95, 0x96, 0x54, 0x41, 0xba, 0xcc, 0x4a, 0xd0, 0x34, 0x4b, 0x2b, 0xc9, 0xfc, - 0x8b, 0x41, 0x7f, 0x2e, 0xe7, 0xd2, 0x9a, 0xa9, 0xb1, 0x9c, 0x7a, 0xbe, 0x45, 0xb8, 0x33, 0x35, - 0x08, 0xf2, 0x04, 0x77, 0xd5, 0x9a, 0x97, 0xb2, 0x8e, 0xd0, 0x08, 0x8d, 0x8f, 0x72, 0xef, 0x11, - 0x82, 0x43, 0x41, 0x39, 0x44, 0x07, 0x56, 0xb5, 0x36, 0xe9, 0xe3, 0x8e, 0xaa, 0x68, 0x0d, 0xd1, - 0x83, 0x11, 0x1a, 0x1f, 0xe7, 0xce, 0x21, 0x67, 0xb8, 0xc7, 0x99, 0x28, 0x5a, 0xc1, 0x74, 0x14, - 0xda, 0xe8, 0x43, 0xce, 0xc4, 0x07, 0xc1, 0x34, 0x79, 0x8e, 0x4f, 0x98, 0x60, 0x9a, 0xd1, 0xba, - 0x50, 0xed, 0x62, 0x51, 0xaf, 0xa3, 0xce, 0x08, 0x8d, 0xc3, 0xfc, 0xd8, 0xab, 0xef, 0xad, 0x48, - 0x9e, 0x61, 0xcc, 0xe9, 0x6a, 0x1f, 0xd2, 0xb5, 0x21, 0x47, 0x9c, 0xae, 0xfc, 0xf5, 0xc0, 0x26, - 0xd0, 0xb4, 0xac, 0x21, 0x3a, 0x1c, 0xa1, 0x71, 0x2f, 0xff, 0xeb, 0x9b, 0x92, 0xe4, 0x67, 0x01, - 0x4d, 0xd4, 0xb3, 0x99, 0x9d, 0x73, 0x11, 0x7e, 0xb9, 0x1d, 0x06, 0xe7, 0xdf, 0x0e, 0x70, 0xf7, - 0x8a, 0x36, 0x94, 0x2b, 0x32, 0xc5, 0x27, 0xb6, 0x63, 0x85, 0xa6, 0xab, 0xa2, 0xa1, 0x1a, 0xdc, - 0x6f, 0x27, 0xc9, 0xe6, 0x7e, 0x18, 0xfc, 0xb8, 0x1f, 0xbe, 0x98, 0x33, 0xfd, 0xa9, 0x2d, 0x93, - 0x4a, 0xf2, 0xd4, 0x37, 0xd4, 0x1d, 0x2f, 0xd5, 0xec, 0x26, 0xd5, 0xeb, 0x05, 0xa8, 0xe4, 0x2d, - 0x54, 0xf9, 0x23, 0x4b, 0x99, 0xd2, 0x55, 0x4e, 0x35, 0x90, 0x2b, 0xdc, 0x67, 0x4a, 0xb5, 0x50, - 0x38, 0xb6, 0x19, 0x41, 0x71, 0x0d, 0xae, 0x67, 0x0f, 0x5f, 0x9d, 0x25, 0x0e, 0x91, 0x18, 0x3d, - 0xf1, 0xa3, 0x49, 0xde, 0x48, 0x26, 0x26, 0xa1, 0x49, 0x9b, 0x9f, 0xda, 0xc7, 0x76, 0x0c, 0x13, - 0xaa, 0xe0, 0x12, 0x80, 0x14, 0xb8, 0x6f, 0xbe, 0xe6, 0x81, 0xd7, 0x00, 0xa6, 0x58, 0x26, 0x6d, - 0xc3, 0xff, 0xbf, 0xda, 0x53, 0xc3, 0xb2, 0xfc, 0x4b, 0x80, 0xdc, 0x80, 0x2e, 0xc2, 0xdf, 0xb7, - 0x43, 0x34, 0x79, 0xb7, 0xf9, 0x15, 0x07, 0x9b, 0x6d, 0x8c, 0xee, 0xb6, 0x31, 0xfa, 0xb9, 0x8d, - 0xd1, 0xd7, 0x5d, 0x1c, 0xdc, 0xed, 0xe2, 0xe0, 0xfb, 0x2e, 0x0e, 0x3e, 0x66, 0xff, 0xe0, 0xcd, - 0xbe, 0x09, 0xd0, 0xe9, 0x7e, 0x2b, 0xb9, 0x9c, 0xb5, 0x35, 0x28, 0xbf, 0x9d, 0x36, 0x95, 0xd9, - 0xba, 0xae, 0x5d, 0xab, 0xd7, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x64, 0x54, 0x8b, 0x20, 0xbe, - 0x02, 0x00, 0x00, + // 511 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0xb5, 0x8b, 0x93, 0x26, 0xd3, 0x87, 0xe8, 0x28, 0x42, 0x6e, 0x04, 0x4e, 0xa8, 0x04, 0xca, + 0x06, 0x9b, 0x94, 0x5d, 0x97, 0x01, 0xba, 0xa5, 0x1a, 0xc2, 0x86, 0x8d, 0x35, 0x76, 0x6e, 0xc3, + 0xa8, 0x9e, 0x99, 0xc8, 0x33, 0x09, 0xc9, 0x1f, 0xb0, 0xe4, 0x13, 0xfa, 0x39, 0x59, 0x56, 0xac, + 0x10, 0x8b, 0x0a, 0x92, 0x0d, 0x5f, 0x81, 0xd0, 0x3c, 0x5a, 0xb1, 0x65, 0xe5, 0x7b, 0xce, 0xcc, + 0x9c, 0x7b, 0x7d, 0xcf, 0x41, 0x8f, 0x59, 0xcd, 0x14, 0x97, 0x93, 0x4c, 0xcb, 0x2b, 0x10, 0xd9, + 0x62, 0xe8, 0x8a, 0x74, 0x56, 0x4b, 0x2d, 0xf1, 0x43, 0x7f, 0x9a, 0x3a, 0x72, 0x31, 0xec, 0x26, + 0xa5, 0x54, 0x5c, 0xaa, 0xac, 0xa0, 0x0a, 0xb2, 0xc5, 0xb0, 0x00, 0x4d, 0x87, 0x59, 0x29, 0x99, + 0x7f, 0xd1, 0xed, 0x4c, 0xe5, 0x54, 0xda, 0x32, 0x33, 0x95, 0x63, 0x4f, 0xfe, 0x84, 0xa8, 0x31, + 0x36, 0x12, 0xf8, 0x11, 0x6a, 0xaa, 0x15, 0x2f, 0x64, 0x15, 0x87, 0xfd, 0x70, 0xd0, 0x26, 0x1e, + 0x61, 0x8c, 0x22, 0x41, 0x39, 0xc4, 0x3b, 0x96, 0xb5, 0x35, 0xee, 0xa0, 0x86, 0x2a, 0x69, 0x05, + 0xf1, 0x83, 0x7e, 0x38, 0x38, 0x20, 0x0e, 0xe0, 0x63, 0xd4, 0xe2, 0x4c, 0xe4, 0x73, 0xc1, 0x74, + 0x1c, 0xd9, 0xdb, 0xbb, 0x9c, 0x89, 0x0f, 0x82, 0x69, 0xfc, 0x0c, 0x1d, 0x32, 0xc1, 0x34, 0xa3, + 0x55, 0xae, 0xe6, 0xb3, 0x59, 0xb5, 0x8a, 0x1b, 0xfd, 0x70, 0x10, 0x91, 0x03, 0xcf, 0xbe, 0xb7, + 0x24, 0x7e, 0x82, 0x10, 0xa7, 0xcb, 0xbb, 0x2b, 0x4d, 0x7b, 0xa5, 0xcd, 0xe9, 0xd2, 0x1f, 0x77, + 0x6d, 0x03, 0x4d, 0x8b, 0x0a, 0xe2, 0xdd, 0x7e, 0x38, 0x68, 0x91, 0x7b, 0x6c, 0x46, 0x92, 0x9f, + 0x05, 0xd4, 0x71, 0xcb, 0x76, 0x76, 0xc0, 0xbc, 0x28, 0xa5, 0xd0, 0x35, 0x2d, 0x75, 0xdc, 0xb6, + 0x07, 0xf7, 0xf8, 0x2c, 0xfa, 0x72, 0xdd, 0x0b, 0x4e, 0xbe, 0xed, 0xa0, 0xe6, 0x05, 0xad, 0x29, + 0x57, 0x78, 0x8c, 0x0e, 0xed, 0x36, 0x73, 0x4d, 0x97, 0x79, 0x4d, 0x35, 0xb8, 0x4d, 0x8c, 0xd2, + 0xf5, 0x6d, 0x2f, 0xf8, 0x71, 0xdb, 0x7b, 0x3e, 0x65, 0xfa, 0xd3, 0xbc, 0x48, 0x4b, 0xc9, 0x33, + 0xbf, 0x6c, 0xf7, 0x79, 0xa1, 0x26, 0x57, 0x99, 0x5e, 0xcd, 0x40, 0xa5, 0x6f, 0xa0, 0x24, 0xfb, + 0x56, 0x65, 0x4c, 0x97, 0x84, 0x6a, 0xc0, 0x17, 0xa8, 0xc3, 0x94, 0x9a, 0x43, 0xee, 0xb4, 0x8d, + 0x3d, 0xf9, 0x25, 0xb8, 0x7d, 0xee, 0x9d, 0x1e, 0xa7, 0x4e, 0x22, 0x35, 0x7c, 0xea, 0x6d, 0x4b, + 0x5f, 0x4b, 0x26, 0x46, 0x91, 0x69, 0x4b, 0x8e, 0xec, 0x63, 0x6b, 0xd1, 0x88, 0x2a, 0x38, 0x07, + 0xc0, 0x39, 0xea, 0x98, 0xdf, 0xf6, 0x82, 0x97, 0x00, 0x66, 0x58, 0x26, 0xad, 0x19, 0xff, 0x3f, + 0xed, 0x91, 0xd1, 0xb2, 0xfa, 0xe7, 0x00, 0xc4, 0x08, 0xe1, 0xa7, 0x68, 0x1f, 0x84, 0xd9, 0x6a, + 0x0e, 0x75, 0x79, 0xfa, 0xd2, 0x9a, 0xd9, 0x22, 0x7b, 0x8e, 0x7b, 0x6b, 0x28, 0x93, 0x96, 0x02, + 0x68, 0x29, 0x85, 0x35, 0xb2, 0x4d, 0x3c, 0x3a, 0x8b, 0x7e, 0x5f, 0xf7, 0xc2, 0xd1, 0xbb, 0xf5, + 0xaf, 0x24, 0x58, 0x6f, 0x92, 0xf0, 0x66, 0x93, 0x84, 0x3f, 0x37, 0x49, 0xf8, 0x75, 0x9b, 0x04, + 0x37, 0xdb, 0x24, 0xf8, 0xbe, 0x4d, 0x82, 0x8f, 0xc3, 0x7f, 0x26, 0x33, 0x31, 0x16, 0xa0, 0xb3, + 0xbb, 0xb0, 0x73, 0x39, 0x99, 0x57, 0xa0, 0x7c, 0xe8, 0xed, 0x94, 0x26, 0xcc, 0x4d, 0x9b, 0xd6, + 0x57, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x94, 0x92, 0x51, 0xfb, 0x15, 0x03, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -179,6 +184,12 @@ func (this *Params) Equal(that interface{}) bool { if !this.MintTokenFeeRatio.Equal(that1.MintTokenFeeRatio) { return false } + if this.EnableErc20 != that1.EnableErc20 { + return false + } + if this.Beacon != that1.Beacon { + return false + } return true } func (m *Token) Marshal() (dAtA []byte, err error) { @@ -201,6 +212,13 @@ func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintToken(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0x4a + } if len(m.Owner) > 0 { i -= len(m.Owner) copy(dAtA[i:], m.Owner) @@ -277,6 +295,23 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Beacon) > 0 { + i -= len(m.Beacon) + copy(dAtA[i:], m.Beacon) + i = encodeVarintToken(dAtA, i, uint64(len(m.Beacon))) + i-- + dAtA[i] = 0x2a + } + if m.EnableErc20 { + i-- + if m.EnableErc20 { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } { size := m.MintTokenFeeRatio.Size() i -= size @@ -355,6 +390,10 @@ func (m *Token) Size() (n int) { if l > 0 { n += 1 + l + sovToken(uint64(l)) } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovToken(uint64(l)) + } return n } @@ -370,6 +409,13 @@ func (m *Params) Size() (n int) { n += 1 + l + sovToken(uint64(l)) l = m.MintTokenFeeRatio.Size() n += 1 + l + sovToken(uint64(l)) + if m.EnableErc20 { + n += 2 + } + l = len(m.Beacon) + if l > 0 { + n += 1 + l + sovToken(uint64(l)) + } return n } @@ -613,6 +659,38 @@ func (m *Token) Unmarshal(dAtA []byte) error { } m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + 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 ErrInvalidLengthToken + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthToken + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipToken(dAtA[iNdEx:]) @@ -764,6 +842,58 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableErc20", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableErc20 = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Beacon", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + 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 ErrInvalidLengthToken + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthToken + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Beacon = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipToken(dAtA[iNdEx:]) diff --git a/modules/token/types/v1/tx.pb.go b/modules/token/types/v1/tx.pb.go index 02b40f1d..932907c6 100644 --- a/modules/token/types/v1/tx.pb.go +++ b/modules/token/types/v1/tx.pb.go @@ -273,9 +273,9 @@ var xxx_messageInfo_MsgEditTokenResponse proto.InternalMessageInfo // MsgMintToken defines an SDK message for minting a new token type MsgMintToken struct { - Coin types.Coin `protobuf:"bytes,1,opt,name=coin,proto3" json:"coin"` - To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` - Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + Coin types.Coin `protobuf:"bytes,1,opt,name=coin,proto3" json:"coin"` + Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"` + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` } func (m *MsgMintToken) Reset() { *m = MsgMintToken{} } @@ -426,9 +426,9 @@ var xxx_messageInfo_MsgBurnTokenResponse proto.InternalMessageInfo // MsgSwapFeeToken defines an SDK message for swap fee token type MsgSwapFeeToken struct { - FeePaid types.Coin `protobuf:"bytes,1,opt,name=fee_paid,json=feePaid,proto3" json:"fee_paid"` - Recipient string `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` - Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` + FeePaid types.Coin `protobuf:"bytes,1,opt,name=fee_paid,json=feePaid,proto3" json:"fee_paid"` + Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"` + Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` } func (m *MsgSwapFeeToken) Reset() { *m = MsgSwapFeeToken{} } @@ -588,6 +588,316 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgDeployERC20 defines an SDK message for DeployERC20 +type MsgDeployERC20 struct { + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Scale uint32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"` + MinUnit string `protobuf:"bytes,4,opt,name=min_unit,json=minUnit,proto3" json:"min_unit,omitempty"` + Authority string `protobuf:"bytes,5,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgDeployERC20) Reset() { *m = MsgDeployERC20{} } +func (m *MsgDeployERC20) String() string { return proto.CompactTextString(m) } +func (*MsgDeployERC20) ProtoMessage() {} +func (*MsgDeployERC20) Descriptor() ([]byte, []int) { + return fileDescriptor_f5fa171367154e01, []int{14} +} +func (m *MsgDeployERC20) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeployERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeployERC20.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 *MsgDeployERC20) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeployERC20.Merge(m, src) +} +func (m *MsgDeployERC20) XXX_Size() int { + return m.Size() +} +func (m *MsgDeployERC20) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeployERC20.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeployERC20 proto.InternalMessageInfo + +// MsgDeployERC20Response defines the Msg/DeployERC20 response type +type MsgDeployERC20Response struct { +} + +func (m *MsgDeployERC20Response) Reset() { *m = MsgDeployERC20Response{} } +func (m *MsgDeployERC20Response) String() string { return proto.CompactTextString(m) } +func (*MsgDeployERC20Response) ProtoMessage() {} +func (*MsgDeployERC20Response) Descriptor() ([]byte, []int) { + return fileDescriptor_f5fa171367154e01, []int{15} +} +func (m *MsgDeployERC20Response) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeployERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeployERC20Response.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 *MsgDeployERC20Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeployERC20Response.Merge(m, src) +} +func (m *MsgDeployERC20Response) XXX_Size() int { + return m.Size() +} +func (m *MsgDeployERC20Response) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeployERC20Response.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeployERC20Response proto.InternalMessageInfo + +// MsgSwapToERC20 defines an SDK message for SwapToERC20 +type MsgSwapToERC20 struct { + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` +} + +func (m *MsgSwapToERC20) Reset() { *m = MsgSwapToERC20{} } +func (m *MsgSwapToERC20) String() string { return proto.CompactTextString(m) } +func (*MsgSwapToERC20) ProtoMessage() {} +func (*MsgSwapToERC20) Descriptor() ([]byte, []int) { + return fileDescriptor_f5fa171367154e01, []int{16} +} +func (m *MsgSwapToERC20) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapToERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapToERC20.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 *MsgSwapToERC20) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapToERC20.Merge(m, src) +} +func (m *MsgSwapToERC20) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapToERC20) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapToERC20.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapToERC20 proto.InternalMessageInfo + +// MsgSwapToERC20Response defines the Msg/SwapToERC20 response type +type MsgSwapToERC20Response struct { +} + +func (m *MsgSwapToERC20Response) Reset() { *m = MsgSwapToERC20Response{} } +func (m *MsgSwapToERC20Response) String() string { return proto.CompactTextString(m) } +func (*MsgSwapToERC20Response) ProtoMessage() {} +func (*MsgSwapToERC20Response) Descriptor() ([]byte, []int) { + return fileDescriptor_f5fa171367154e01, []int{17} +} +func (m *MsgSwapToERC20Response) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapToERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapToERC20Response.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 *MsgSwapToERC20Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapToERC20Response.Merge(m, src) +} +func (m *MsgSwapToERC20Response) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapToERC20Response) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapToERC20Response.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapToERC20Response proto.InternalMessageInfo + +// MsgSwapFromERC20 defines an SDK message for SwapFromERC20 +type MsgSwapFromERC20 struct { + WantedAmount types.Coin `protobuf:"bytes,1,opt,name=wanted_amount,json=wantedAmount,proto3" json:"wanted_amount"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` +} + +func (m *MsgSwapFromERC20) Reset() { *m = MsgSwapFromERC20{} } +func (m *MsgSwapFromERC20) String() string { return proto.CompactTextString(m) } +func (*MsgSwapFromERC20) ProtoMessage() {} +func (*MsgSwapFromERC20) Descriptor() ([]byte, []int) { + return fileDescriptor_f5fa171367154e01, []int{18} +} +func (m *MsgSwapFromERC20) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapFromERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapFromERC20.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 *MsgSwapFromERC20) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapFromERC20.Merge(m, src) +} +func (m *MsgSwapFromERC20) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapFromERC20) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapFromERC20.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapFromERC20 proto.InternalMessageInfo + +// MsgSwapFromERC20Response defines the Msg/SwapFromERC20 response type +type MsgSwapFromERC20Response struct { +} + +func (m *MsgSwapFromERC20Response) Reset() { *m = MsgSwapFromERC20Response{} } +func (m *MsgSwapFromERC20Response) String() string { return proto.CompactTextString(m) } +func (*MsgSwapFromERC20Response) ProtoMessage() {} +func (*MsgSwapFromERC20Response) Descriptor() ([]byte, []int) { + return fileDescriptor_f5fa171367154e01, []int{19} +} +func (m *MsgSwapFromERC20Response) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapFromERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapFromERC20Response.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 *MsgSwapFromERC20Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapFromERC20Response.Merge(m, src) +} +func (m *MsgSwapFromERC20Response) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapFromERC20Response) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapFromERC20Response.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapFromERC20Response proto.InternalMessageInfo + +// MsgUpgradeERC20 defines an SDK message for UpgradeERC20 +type MsgUpgradeERC20 struct { + // implementation is the new erc20 contract address + Implementation string `protobuf:"bytes,1,opt,name=implementation,proto3" json:"implementation,omitempty"` + Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgUpgradeERC20) Reset() { *m = MsgUpgradeERC20{} } +func (m *MsgUpgradeERC20) String() string { return proto.CompactTextString(m) } +func (*MsgUpgradeERC20) ProtoMessage() {} +func (*MsgUpgradeERC20) Descriptor() ([]byte, []int) { + return fileDescriptor_f5fa171367154e01, []int{20} +} +func (m *MsgUpgradeERC20) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpgradeERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpgradeERC20.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 *MsgUpgradeERC20) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpgradeERC20.Merge(m, src) +} +func (m *MsgUpgradeERC20) XXX_Size() int { + return m.Size() +} +func (m *MsgUpgradeERC20) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpgradeERC20.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpgradeERC20 proto.InternalMessageInfo + +// MsgUpgradeERC20Response defines the Msg/UpgradeERC20 response type +type MsgUpgradeERC20Response struct { +} + +func (m *MsgUpgradeERC20Response) Reset() { *m = MsgUpgradeERC20Response{} } +func (m *MsgUpgradeERC20Response) String() string { return proto.CompactTextString(m) } +func (*MsgUpgradeERC20Response) ProtoMessage() {} +func (*MsgUpgradeERC20Response) Descriptor() ([]byte, []int) { + return fileDescriptor_f5fa171367154e01, []int{21} +} +func (m *MsgUpgradeERC20Response) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpgradeERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpgradeERC20Response.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 *MsgUpgradeERC20Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpgradeERC20Response.Merge(m, src) +} +func (m *MsgUpgradeERC20Response) XXX_Size() int { + return m.Size() +} +func (m *MsgUpgradeERC20Response) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpgradeERC20Response.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpgradeERC20Response proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgIssueToken)(nil), "irismod.token.v1.MsgIssueToken") proto.RegisterType((*MsgIssueTokenResponse)(nil), "irismod.token.v1.MsgIssueTokenResponse") @@ -603,67 +913,88 @@ func init() { proto.RegisterType((*MsgSwapFeeTokenResponse)(nil), "irismod.token.v1.MsgSwapFeeTokenResponse") proto.RegisterType((*MsgUpdateParams)(nil), "irismod.token.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "irismod.token.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgDeployERC20)(nil), "irismod.token.v1.MsgDeployERC20") + proto.RegisterType((*MsgDeployERC20Response)(nil), "irismod.token.v1.MsgDeployERC20Response") + proto.RegisterType((*MsgSwapToERC20)(nil), "irismod.token.v1.MsgSwapToERC20") + proto.RegisterType((*MsgSwapToERC20Response)(nil), "irismod.token.v1.MsgSwapToERC20Response") + proto.RegisterType((*MsgSwapFromERC20)(nil), "irismod.token.v1.MsgSwapFromERC20") + proto.RegisterType((*MsgSwapFromERC20Response)(nil), "irismod.token.v1.MsgSwapFromERC20Response") + proto.RegisterType((*MsgUpgradeERC20)(nil), "irismod.token.v1.MsgUpgradeERC20") + proto.RegisterType((*MsgUpgradeERC20Response)(nil), "irismod.token.v1.MsgUpgradeERC20Response") } func init() { proto.RegisterFile("irismod/token/v1/tx.proto", fileDescriptor_f5fa171367154e01) } var fileDescriptor_f5fa171367154e01 = []byte{ - // 875 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcf, 0x8f, 0xdb, 0x44, - 0x14, 0x8e, 0xf3, 0x6b, 0x93, 0xd9, 0xee, 0x82, 0x46, 0xa1, 0xeb, 0x98, 0xd6, 0x09, 0x91, 0x80, - 0x50, 0x09, 0x9b, 0xec, 0x4a, 0x05, 0xe5, 0x46, 0x10, 0x20, 0x0e, 0x51, 0xab, 0xa4, 0xe5, 0x80, - 0x90, 0xa2, 0x49, 0x3c, 0x71, 0x47, 0xc4, 0x33, 0x96, 0x67, 0xb2, 0xdd, 0xdc, 0x50, 0x8f, 0x5c, - 0x0a, 0xe2, 0xbf, 0xe0, 0xd4, 0x03, 0x7f, 0xc4, 0x1e, 0x2b, 0x4e, 0x9c, 0x2a, 0xd8, 0x3d, 0xac, - 0xc4, 0x9f, 0xc0, 0x09, 0x79, 0x66, 0xe2, 0x38, 0x1b, 0xef, 0x4f, 0x6e, 0x9e, 0xf9, 0x3e, 0xbf, - 0xf7, 0xcd, 0xf7, 0xde, 0x1b, 0x1b, 0xd4, 0x49, 0x44, 0x78, 0xc0, 0x3c, 0x57, 0xb0, 0x1f, 0x30, - 0x75, 0x0f, 0x3b, 0xae, 0x38, 0x72, 0xc2, 0x88, 0x09, 0x06, 0xdf, 0xd6, 0x90, 0x23, 0x21, 0xe7, - 0xb0, 0x63, 0xd5, 0x7c, 0xe6, 0x33, 0x09, 0xba, 0xf1, 0x93, 0xe2, 0x59, 0xf6, 0x84, 0xf1, 0x80, - 0x71, 0x77, 0x8c, 0x38, 0x76, 0x0f, 0x3b, 0x63, 0x2c, 0x50, 0xc7, 0x9d, 0x30, 0x42, 0x35, 0xbe, - 0xa7, 0xf1, 0x80, 0xfb, 0x71, 0xfc, 0x80, 0xfb, 0x1a, 0xa8, 0x2b, 0x60, 0xa4, 0x22, 0xaa, 0x85, - 0x86, 0xee, 0x6d, 0xca, 0x92, 0x22, 0x24, 0xda, 0xfa, 0x29, 0x0f, 0x76, 0xfa, 0xdc, 0xff, 0x86, - 0xf3, 0x39, 0x7e, 0x12, 0xef, 0xc3, 0xbb, 0xa0, 0xcc, 0x17, 0xc1, 0x98, 0xcd, 0x4c, 0xa3, 0x69, - 0xb4, 0xab, 0x03, 0xbd, 0x82, 0x10, 0x14, 0x29, 0x0a, 0xb0, 0x99, 0x97, 0xbb, 0xf2, 0x19, 0xd6, - 0x40, 0x89, 0x4f, 0xd0, 0x0c, 0x9b, 0x85, 0xa6, 0xd1, 0xde, 0x19, 0xa8, 0x05, 0xac, 0x83, 0x4a, - 0x40, 0xe8, 0x68, 0x4e, 0x89, 0x30, 0x8b, 0x92, 0xbd, 0x15, 0x10, 0xfa, 0x94, 0x12, 0x01, 0xdf, - 0x07, 0xbb, 0x84, 0x12, 0x41, 0xd0, 0x6c, 0xc4, 0xe7, 0x61, 0x38, 0x5b, 0x98, 0xa5, 0xa6, 0xd1, - 0x2e, 0x0e, 0x76, 0xf4, 0xee, 0x50, 0x6e, 0xc2, 0xfb, 0x00, 0x04, 0xe8, 0x68, 0x49, 0x29, 0x4b, - 0x4a, 0x35, 0x40, 0x47, 0x1a, 0xb6, 0x64, 0x02, 0x81, 0xc6, 0x33, 0x6c, 0x6e, 0x35, 0x8d, 0x76, - 0x65, 0x90, 0xac, 0xa1, 0x03, 0x4a, 0xec, 0x39, 0xc5, 0x91, 0x59, 0x89, 0x33, 0xf7, 0xcc, 0x3f, - 0x7e, 0xff, 0xb8, 0xa6, 0xfd, 0xf8, 0xdc, 0xf3, 0x22, 0xcc, 0xf9, 0x50, 0x44, 0x84, 0xfa, 0x03, - 0x45, 0xeb, 0x82, 0x17, 0x67, 0xaf, 0x1e, 0xa8, 0xe7, 0xd6, 0x1e, 0x78, 0x67, 0xcd, 0x8b, 0x01, - 0xe6, 0x21, 0xa3, 0x1c, 0xb7, 0x7e, 0x35, 0x24, 0xf2, 0x24, 0x42, 0x94, 0x4f, 0x71, 0x24, 0xc1, - 0x47, 0xf1, 0x2b, 0xf0, 0x5d, 0x50, 0xe5, 0xd1, 0x64, 0xa4, 0x52, 0x2a, 0xc3, 0x2a, 0x3c, 0x9a, - 0x24, 0xa0, 0xc7, 0x85, 0x06, 0x95, 0x6f, 0x15, 0x8f, 0x0b, 0x05, 0x7e, 0x92, 0xf8, 0x5c, 0xb8, - 0x42, 0xa9, 0xe6, 0x75, 0x77, 0x63, 0xa9, 0xab, 0x74, 0xad, 0x06, 0xb8, 0x9f, 0x29, 0x2a, 0x91, - 0xfd, 0x8f, 0x01, 0xee, 0xf4, 0xb9, 0xff, 0xa5, 0x47, 0xc4, 0xcd, 0x6b, 0xbb, 0x5e, 0x83, 0xc2, - 0xf9, 0x1a, 0x0c, 0x53, 0x35, 0x90, 0x45, 0xee, 0x7d, 0xfa, 0xef, 0x9b, 0xc6, 0x81, 0x4f, 0xc4, - 0xb3, 0xf9, 0xd8, 0x99, 0xb0, 0xc0, 0x8d, 0xfb, 0x8e, 0x62, 0xe1, 0x2e, 0xfb, 0x2f, 0x60, 0xde, - 0x7c, 0x86, 0xb9, 0xee, 0x43, 0xb1, 0x08, 0x31, 0x77, 0x7a, 0x8c, 0xcd, 0xb2, 0x8a, 0x57, 0xba, - 0x79, 0xf1, 0xee, 0x82, 0x5a, 0xfa, 0xac, 0x89, 0x09, 0x2f, 0x95, 0x09, 0x7d, 0x42, 0xb5, 0x09, - 0x07, 0xa0, 0x18, 0x8f, 0x94, 0xb4, 0x60, 0x7b, 0xbf, 0xee, 0xe8, 0x04, 0xf1, 0xcc, 0x39, 0x7a, - 0xe6, 0x9c, 0x2f, 0x18, 0xa1, 0xbd, 0xe2, 0xf1, 0x9b, 0x46, 0x6e, 0x20, 0xc9, 0x70, 0x17, 0xe4, - 0x05, 0xd3, 0xfe, 0xe4, 0x05, 0x5b, 0x29, 0x2d, 0xdc, 0x56, 0x69, 0x22, 0x28, 0x51, 0xfa, 0x42, - 0x29, 0xed, 0xcd, 0x23, 0xfa, 0x3f, 0x94, 0xc6, 0x7d, 0x85, 0xa9, 0xb7, 0xec, 0xb8, 0x4b, 0xfb, - 0x4a, 0xf2, 0xba, 0xdb, 0xb1, 0x36, 0xbd, 0xd0, 0xe2, 0x12, 0x0d, 0x89, 0xb8, 0xdf, 0x0c, 0xf0, - 0x56, 0x9f, 0xfb, 0xc3, 0xe7, 0x28, 0xfc, 0x0a, 0xeb, 0xab, 0xa2, 0x0b, 0x2a, 0x53, 0x8c, 0x47, - 0x21, 0x22, 0xde, 0x75, 0x35, 0x6e, 0x4d, 0x31, 0x7e, 0x8c, 0x88, 0x07, 0xef, 0x81, 0x6a, 0x84, - 0x27, 0x24, 0x24, 0x98, 0x0a, 0xed, 0xeb, 0x6a, 0x23, 0x75, 0x88, 0xc2, 0x6d, 0x0e, 0x31, 0x04, - 0x7b, 0xe7, 0xb4, 0x2e, 0xcf, 0x01, 0x3f, 0x03, 0xb1, 0x84, 0x91, 0xcf, 0xc4, 0x75, 0x25, 0x97, - 0xa7, 0x18, 0x7f, 0xcd, 0x44, 0xeb, 0x17, 0xe5, 0xc0, 0xd3, 0xd0, 0x43, 0x02, 0x3f, 0x46, 0x11, - 0x0a, 0x38, 0x7c, 0x08, 0xaa, 0x68, 0x2e, 0x9e, 0xb1, 0x88, 0x88, 0x85, 0x9a, 0xa9, 0x4b, 0xa4, - 0xae, 0xa8, 0xf0, 0x21, 0x28, 0x87, 0x32, 0x82, 0x3c, 0xfa, 0xf6, 0xbe, 0xe9, 0x9c, 0xff, 0x42, - 0x38, 0x2a, 0xc3, 0x52, 0x83, 0x62, 0xeb, 0x2b, 0x20, 0x89, 0xd3, 0xaa, 0xcb, 0x83, 0xa6, 0x25, - 0x2d, 0x0f, 0xba, 0xff, 0xb2, 0x04, 0x0a, 0x7d, 0xee, 0xc3, 0x6f, 0x01, 0x48, 0xdd, 0xee, 0x8d, - 0xcd, 0x44, 0x6b, 0x57, 0x9e, 0xf5, 0xe1, 0x15, 0x84, 0xc4, 0xc8, 0x21, 0xa8, 0xae, 0x2e, 0x16, - 0x3b, 0xf3, 0xad, 0x04, 0xb7, 0x3e, 0xb8, 0x1c, 0x4f, 0x07, 0x5d, 0x0d, 0x6a, 0x76, 0xd0, 0x04, - 0xbf, 0x20, 0xe8, 0xc6, 0x5c, 0xc5, 0x41, 0x57, 0x33, 0x95, 0x1d, 0x34, 0xc1, 0x2f, 0x08, 0xba, - 0x31, 0x0f, 0x90, 0x02, 0x98, 0xf1, 0x39, 0xc8, 0x76, 0x6f, 0x93, 0x68, 0xb9, 0xd7, 0x24, 0x26, - 0xf9, 0xbe, 0x07, 0x77, 0xd6, 0x66, 0xef, 0xbd, 0xcc, 0x00, 0x69, 0x8a, 0xf5, 0xd1, 0x95, 0x94, - 0x74, 0xf4, 0xb5, 0xbe, 0xce, 0x8e, 0x9e, 0xa6, 0x5c, 0x10, 0x3d, 0xab, 0x15, 0xad, 0xd2, 0x8f, - 0x67, 0xaf, 0x1e, 0x18, 0xbd, 0x47, 0xc7, 0x7f, 0xdb, 0xb9, 0xe3, 0x13, 0xdb, 0x78, 0x7d, 0x62, - 0x1b, 0x7f, 0x9d, 0xd8, 0xc6, 0xcf, 0xa7, 0x76, 0xee, 0xf5, 0xa9, 0x9d, 0xfb, 0xf3, 0xd4, 0xce, - 0x7d, 0xd7, 0xb9, 0xd9, 0xa7, 0x23, 0xfe, 0x3d, 0x2a, 0xcb, 0x7f, 0x98, 0x83, 0xff, 0x02, 0x00, - 0x00, 0xff, 0xff, 0xfe, 0x30, 0x29, 0xcb, 0x7a, 0x09, 0x00, 0x00, + // 1086 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xc6, 0xb1, 0xe3, 0x4c, 0x7e, 0x50, 0xad, 0x42, 0xb2, 0x59, 0xa8, 0x13, 0x2c, 0x51, + 0x42, 0x24, 0xd6, 0x4d, 0x82, 0x5a, 0x94, 0x5b, 0xdd, 0x16, 0xc4, 0xc1, 0x6a, 0x65, 0xa7, 0x48, + 0x20, 0x24, 0x6b, 0xe2, 0x9d, 0x6c, 0x47, 0x78, 0x67, 0x56, 0x3b, 0xe3, 0xfc, 0xb8, 0x41, 0xc5, + 0x89, 0x13, 0x88, 0x23, 0x57, 0x90, 0x38, 0xf6, 0xc0, 0x1f, 0x91, 0x0b, 0x52, 0xc5, 0x89, 0x53, + 0x05, 0xc9, 0xa1, 0x12, 0x7f, 0x02, 0x27, 0xb4, 0x33, 0xb3, 0xb3, 0xbb, 0xf6, 0x6e, 0x62, 0x07, + 0xf5, 0xe6, 0xd9, 0xf7, 0xed, 0x9b, 0xef, 0xfb, 0xde, 0x9b, 0x79, 0x6b, 0xb0, 0x86, 0x43, 0xcc, + 0x7c, 0xea, 0x36, 0x38, 0xfd, 0x0a, 0x91, 0xc6, 0xd1, 0x76, 0x83, 0x9f, 0x38, 0x41, 0x48, 0x39, + 0x35, 0x6f, 0xa8, 0x90, 0x23, 0x42, 0xce, 0xd1, 0xb6, 0xbd, 0xec, 0x51, 0x8f, 0x8a, 0x60, 0x23, + 0xfa, 0x25, 0x71, 0x76, 0xad, 0x47, 0x99, 0x4f, 0x59, 0xe3, 0x00, 0x32, 0xd4, 0x38, 0xda, 0x3e, + 0x40, 0x1c, 0x6e, 0x37, 0x7a, 0x14, 0x13, 0x15, 0x5f, 0x55, 0x71, 0x9f, 0x79, 0x51, 0x7e, 0x9f, + 0x79, 0x2a, 0xb0, 0x26, 0x03, 0x5d, 0x99, 0x51, 0x2e, 0x54, 0xe8, 0xed, 0x51, 0x5a, 0x82, 0x84, + 0x88, 0xd6, 0xbf, 0x9b, 0x06, 0x8b, 0x2d, 0xe6, 0x7d, 0xca, 0xd8, 0x00, 0xed, 0x47, 0xcf, 0xcd, + 0x15, 0x50, 0x61, 0xa7, 0xfe, 0x01, 0xed, 0x5b, 0xc6, 0x86, 0xb1, 0x39, 0xd7, 0x56, 0x2b, 0xd3, + 0x04, 0x33, 0x04, 0xfa, 0xc8, 0x9a, 0x16, 0x4f, 0xc5, 0x6f, 0x73, 0x19, 0x94, 0x59, 0x0f, 0xf6, + 0x91, 0x55, 0xda, 0x30, 0x36, 0x17, 0xdb, 0x72, 0x61, 0xae, 0x81, 0xaa, 0x8f, 0x49, 0x77, 0x40, + 0x30, 0xb7, 0x66, 0x04, 0x7a, 0xd6, 0xc7, 0xe4, 0x09, 0xc1, 0xdc, 0x7c, 0x17, 0x2c, 0x61, 0x82, + 0x39, 0x86, 0xfd, 0x2e, 0x1b, 0x04, 0x41, 0xff, 0xd4, 0x2a, 0x6f, 0x18, 0x9b, 0x33, 0xed, 0x45, + 0xf5, 0xb4, 0x23, 0x1e, 0x9a, 0x37, 0x01, 0xf0, 0xe1, 0x49, 0x0c, 0xa9, 0x08, 0xc8, 0x9c, 0x0f, + 0x4f, 0x54, 0xd8, 0x16, 0x1b, 0x70, 0x78, 0xd0, 0x47, 0xd6, 0xec, 0x86, 0xb1, 0x59, 0x6d, 0xeb, + 0xb5, 0xe9, 0x80, 0x32, 0x3d, 0x26, 0x28, 0xb4, 0xaa, 0xd1, 0xce, 0x4d, 0xeb, 0x8f, 0xdf, 0x3e, + 0x58, 0x56, 0x7e, 0xdc, 0x73, 0xdd, 0x10, 0x31, 0xd6, 0xe1, 0x21, 0x26, 0x5e, 0x5b, 0xc2, 0xf6, + 0xc0, 0xb3, 0x57, 0xcf, 0xb7, 0xe4, 0xef, 0xfa, 0x2a, 0x78, 0x33, 0xe3, 0x45, 0x1b, 0xb1, 0x80, + 0x12, 0x86, 0xea, 0x3f, 0x1a, 0x22, 0xb2, 0x1f, 0x42, 0xc2, 0x0e, 0x51, 0x28, 0x82, 0x8f, 0xa2, + 0x57, 0xcc, 0xb7, 0xc0, 0x1c, 0x0b, 0x7b, 0x5d, 0xb9, 0xa5, 0x34, 0xac, 0xca, 0xc2, 0x9e, 0x0e, + 0xba, 0x8c, 0xab, 0xa0, 0xf4, 0xad, 0xea, 0x32, 0x2e, 0x83, 0xb7, 0xb5, 0xcf, 0xa5, 0x2b, 0x98, + 0x2a, 0xdc, 0xde, 0x52, 0x44, 0x35, 0xd9, 0xae, 0xbe, 0x0e, 0x6e, 0xe6, 0x92, 0xd2, 0xb4, 0xff, + 0x31, 0xc0, 0x42, 0x8b, 0x79, 0x0f, 0x5d, 0xcc, 0x27, 0xaf, 0x6d, 0xb6, 0x06, 0xa5, 0xe1, 0x1a, + 0x74, 0x52, 0x35, 0x10, 0x45, 0x6e, 0xde, 0xfd, 0xf7, 0xe5, 0xfa, 0xae, 0x87, 0xf9, 0xd3, 0xc1, + 0x81, 0xd3, 0xa3, 0x7e, 0x23, 0xea, 0x3b, 0x82, 0x78, 0x23, 0xee, 0x3f, 0x9f, 0xba, 0x83, 0x3e, + 0x62, 0xaa, 0x0f, 0xf9, 0x69, 0x80, 0x98, 0xd3, 0xa4, 0xb4, 0x9f, 0x57, 0xbc, 0xf2, 0xe4, 0xc5, + 0x5b, 0x01, 0xcb, 0x69, 0xad, 0xda, 0x84, 0x9f, 0xa4, 0x09, 0x2d, 0x4c, 0x94, 0x09, 0xbb, 0x60, + 0x26, 0x3a, 0x52, 0xc2, 0x82, 0xf9, 0x9d, 0x35, 0x47, 0x6d, 0x10, 0x9d, 0x39, 0x47, 0x9d, 0x39, + 0xe7, 0x3e, 0xc5, 0xa4, 0x39, 0x73, 0xf6, 0x72, 0x7d, 0xaa, 0x2d, 0xc0, 0x51, 0xcb, 0x85, 0xa8, + 0x87, 0xf0, 0x51, 0x52, 0xc9, 0x78, 0x9d, 0xb0, 0x2e, 0x5d, 0x97, 0xb5, 0x26, 0xa7, 0x59, 0x3f, + 0x93, 0xac, 0x9b, 0x83, 0x90, 0xfc, 0x0f, 0xd6, 0x51, 0x8f, 0x21, 0xe2, 0xc6, 0x9c, 0x2f, 0xed, + 0x31, 0x81, 0xdb, 0x9b, 0x8f, 0xb8, 0xa9, 0x85, 0x22, 0xa7, 0x39, 0x68, 0x72, 0xbf, 0x1a, 0xe0, + 0x8d, 0x16, 0xf3, 0x3a, 0xc7, 0x30, 0xf8, 0x18, 0xa9, 0x6b, 0x63, 0x0f, 0x54, 0x0f, 0x11, 0xea, + 0x06, 0x10, 0xbb, 0xe3, 0x72, 0x9c, 0x3d, 0x44, 0xe8, 0x31, 0xc4, 0xee, 0xa5, 0xe6, 0x26, 0x12, + 0x4a, 0xd7, 0x91, 0xd0, 0x01, 0xab, 0x43, 0x4c, 0x63, 0x15, 0xe6, 0x47, 0x20, 0x22, 0xd0, 0xf5, + 0x28, 0x1f, 0x97, 0x70, 0xe5, 0x10, 0xa1, 0x4f, 0x28, 0xaf, 0xff, 0x20, 0xf5, 0x3f, 0x09, 0x5c, + 0xc8, 0xd1, 0x63, 0x18, 0x42, 0x9f, 0x99, 0x77, 0xc0, 0x1c, 0x1c, 0xf0, 0xa7, 0x34, 0xc4, 0xfc, + 0x54, 0x9e, 0xae, 0x4b, 0xa8, 0x26, 0x50, 0xf3, 0x0e, 0xa8, 0x04, 0x22, 0x83, 0x50, 0x3e, 0xbf, + 0x63, 0x39, 0xc3, 0xb3, 0xc2, 0x91, 0x3b, 0xc4, 0x1c, 0x24, 0x5a, 0x5d, 0x06, 0x3a, 0x4f, 0x7d, + 0x4d, 0x08, 0x4d, 0x53, 0xd2, 0xe5, 0xfa, 0xc5, 0x00, 0x4b, 0x2d, 0xe6, 0x3d, 0x40, 0x41, 0x9f, + 0x9e, 0x3e, 0x6c, 0xdf, 0xdf, 0xb9, 0xfd, 0x7a, 0x2f, 0xf9, 0x8c, 0x15, 0xe5, 0xb1, 0xad, 0xa8, + 0x5b, 0x60, 0x25, 0x4b, 0x53, 0x2b, 0xf8, 0x59, 0x2a, 0x88, 0xca, 0xb8, 0x4f, 0xa5, 0x82, 0xbb, + 0xa0, 0x02, 0x7d, 0x3a, 0x20, 0xe3, 0x17, 0x4f, 0xc2, 0x27, 0x3f, 0x13, 0x99, 0xf6, 0x2c, 0x65, + 0xdb, 0x33, 0xdb, 0x6c, 0x52, 0x40, 0x8a, 0xa5, 0x16, 0xf0, 0xbb, 0x01, 0x6e, 0xc4, 0x7d, 0x18, + 0x52, 0x5f, 0x4a, 0x78, 0x00, 0x16, 0x8f, 0x21, 0xe1, 0xc8, 0xed, 0x4e, 0xa6, 0x64, 0x41, 0xbe, + 0x75, 0xef, 0xba, 0x7a, 0x3e, 0x1c, 0xd6, 0x73, 0xc9, 0x3b, 0x05, 0x4a, 0x6d, 0x60, 0x0d, 0xcb, + 0xd1, 0x5a, 0xbf, 0x89, 0x4f, 0x87, 0x17, 0x42, 0x17, 0x49, 0xa9, 0xb7, 0xc0, 0x12, 0xf6, 0x83, + 0x3e, 0xf2, 0x11, 0xe1, 0x90, 0x63, 0x4a, 0x54, 0xdf, 0x0d, 0x3d, 0xcd, 0xb6, 0xce, 0xf4, 0xd8, + 0xad, 0x53, 0x78, 0x1a, 0x12, 0x0a, 0x31, 0xbd, 0x9d, 0x6f, 0xab, 0xa0, 0xd4, 0x62, 0x9e, 0xf9, + 0x19, 0x00, 0xa9, 0xaf, 0x9e, 0xf5, 0xd1, 0x63, 0x97, 0xf9, 0x14, 0xb0, 0xdf, 0xbb, 0x02, 0xa0, + 0xaf, 0x95, 0x0e, 0x98, 0x4b, 0x06, 0x6e, 0x2d, 0xf7, 0x2d, 0x1d, 0xb7, 0x6f, 0x5d, 0x1e, 0x4f, + 0x27, 0x4d, 0x06, 0x58, 0x7e, 0x52, 0x1d, 0x2f, 0x48, 0x3a, 0x32, 0x63, 0xa2, 0xa4, 0xc9, 0x7c, + 0xc9, 0x4f, 0xaa, 0xe3, 0x05, 0x49, 0x47, 0x66, 0x83, 0x49, 0x80, 0x99, 0xf3, 0x99, 0x94, 0xef, + 0xde, 0x28, 0xd0, 0x6e, 0x8c, 0x09, 0xd4, 0xfb, 0x7d, 0x09, 0x16, 0x32, 0x73, 0xe8, 0x9d, 0xdc, + 0x04, 0x69, 0x88, 0xfd, 0xfe, 0x95, 0x10, 0x9d, 0xfd, 0x73, 0x30, 0x9f, 0xbe, 0x74, 0x36, 0x0a, + 0xdf, 0x54, 0x08, 0x7b, 0xf3, 0x2a, 0x84, 0x4e, 0xdd, 0x05, 0x8b, 0xd9, 0xeb, 0xa0, 0x5e, 0x4c, + 0x2b, 0xc6, 0xd8, 0x5b, 0x57, 0x63, 0xd2, 0xce, 0x64, 0x26, 0x54, 0xbe, 0x33, 0x69, 0x48, 0x81, + 0x33, 0x79, 0x43, 0x25, 0x72, 0x26, 0x3d, 0x50, 0xf2, 0x9d, 0x49, 0x21, 0x0a, 0x9c, 0xc9, 0xb9, + 0xed, 0x25, 0xf1, 0xd4, 0xe5, 0x51, 0x44, 0x3c, 0x81, 0x14, 0x12, 0x1f, 0x3d, 0xff, 0x76, 0xf9, + 0xeb, 0x57, 0xcf, 0xb7, 0x8c, 0xe6, 0xa3, 0xb3, 0xbf, 0x6b, 0x53, 0x67, 0xe7, 0x35, 0xe3, 0xc5, + 0x79, 0xcd, 0xf8, 0xeb, 0xbc, 0x66, 0x7c, 0x7f, 0x51, 0x9b, 0x7a, 0x71, 0x51, 0x9b, 0xfa, 0xf3, + 0xa2, 0x36, 0xf5, 0xc5, 0xf6, 0x64, 0xdf, 0xb1, 0xd1, 0x7f, 0xb5, 0x8a, 0xf8, 0x43, 0xb5, 0xfb, + 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, 0xbd, 0x49, 0x69, 0x07, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -688,13 +1019,24 @@ type MsgClient interface { BurnToken(ctx context.Context, in *MsgBurnToken, opts ...grpc.CallOption) (*MsgBurnTokenResponse, error) // TransferTokenOwner defines a method for transfering token owner TransferTokenOwner(ctx context.Context, in *MsgTransferTokenOwner, opts ...grpc.CallOption) (*MsgTransferTokenOwnerResponse, error) - // SwapFeeToken defines a method for swap some fee token + // SwapFeeToken defines a method for swapping between IRIS and ERIS SwapFeeToken(ctx context.Context, in *MsgSwapFeeToken, opts ...grpc.CallOption) (*MsgSwapFeeTokenResponse, error) + // SwapToERC20 defines a method for swapping some native token to its ERC20 + // counterpart + SwapToERC20(ctx context.Context, in *MsgSwapToERC20, opts ...grpc.CallOption) (*MsgSwapToERC20Response, error) + // SwapFromERC20 defines a method for swapping some ERC20 token to its native + // counterpart + SwapFromERC20(ctx context.Context, in *MsgSwapFromERC20, opts ...grpc.CallOption) (*MsgSwapFromERC20Response, error) // UpdateParams defines a governance operation for updating the token // module parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // DeployERC20 defines a governance operation for deploying an ERC20 contract + // that binds to a native token + DeployERC20(ctx context.Context, in *MsgDeployERC20, opts ...grpc.CallOption) (*MsgDeployERC20Response, error) + // UpgradeERC20 defines a governance operation for upgrading an ERC20 contract + UpgradeERC20(ctx context.Context, in *MsgUpgradeERC20, opts ...grpc.CallOption) (*MsgUpgradeERC20Response, error) } type msgClient struct { @@ -759,6 +1101,24 @@ func (c *msgClient) SwapFeeToken(ctx context.Context, in *MsgSwapFeeToken, opts return out, nil } +func (c *msgClient) SwapToERC20(ctx context.Context, in *MsgSwapToERC20, opts ...grpc.CallOption) (*MsgSwapToERC20Response, error) { + out := new(MsgSwapToERC20Response) + err := c.cc.Invoke(ctx, "/irismod.token.v1.Msg/SwapToERC20", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SwapFromERC20(ctx context.Context, in *MsgSwapFromERC20, opts ...grpc.CallOption) (*MsgSwapFromERC20Response, error) { + out := new(MsgSwapFromERC20Response) + err := c.cc.Invoke(ctx, "/irismod.token.v1.Msg/SwapFromERC20", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { out := new(MsgUpdateParamsResponse) err := c.cc.Invoke(ctx, "/irismod.token.v1.Msg/UpdateParams", in, out, opts...) @@ -768,6 +1128,24 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) DeployERC20(ctx context.Context, in *MsgDeployERC20, opts ...grpc.CallOption) (*MsgDeployERC20Response, error) { + out := new(MsgDeployERC20Response) + err := c.cc.Invoke(ctx, "/irismod.token.v1.Msg/DeployERC20", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpgradeERC20(ctx context.Context, in *MsgUpgradeERC20, opts ...grpc.CallOption) (*MsgUpgradeERC20Response, error) { + out := new(MsgUpgradeERC20Response) + err := c.cc.Invoke(ctx, "/irismod.token.v1.Msg/UpgradeERC20", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // IssueToken defines a method for issuing a new token @@ -780,13 +1158,24 @@ type MsgServer interface { BurnToken(context.Context, *MsgBurnToken) (*MsgBurnTokenResponse, error) // TransferTokenOwner defines a method for transfering token owner TransferTokenOwner(context.Context, *MsgTransferTokenOwner) (*MsgTransferTokenOwnerResponse, error) - // SwapFeeToken defines a method for swap some fee token + // SwapFeeToken defines a method for swapping between IRIS and ERIS SwapFeeToken(context.Context, *MsgSwapFeeToken) (*MsgSwapFeeTokenResponse, error) + // SwapToERC20 defines a method for swapping some native token to its ERC20 + // counterpart + SwapToERC20(context.Context, *MsgSwapToERC20) (*MsgSwapToERC20Response, error) + // SwapFromERC20 defines a method for swapping some ERC20 token to its native + // counterpart + SwapFromERC20(context.Context, *MsgSwapFromERC20) (*MsgSwapFromERC20Response, error) // UpdateParams defines a governance operation for updating the token // module parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // DeployERC20 defines a governance operation for deploying an ERC20 contract + // that binds to a native token + DeployERC20(context.Context, *MsgDeployERC20) (*MsgDeployERC20Response, error) + // UpgradeERC20 defines a governance operation for upgrading an ERC20 contract + UpgradeERC20(context.Context, *MsgUpgradeERC20) (*MsgUpgradeERC20Response, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -811,9 +1200,21 @@ func (*UnimplementedMsgServer) TransferTokenOwner(ctx context.Context, req *MsgT func (*UnimplementedMsgServer) SwapFeeToken(ctx context.Context, req *MsgSwapFeeToken) (*MsgSwapFeeTokenResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SwapFeeToken not implemented") } +func (*UnimplementedMsgServer) SwapToERC20(ctx context.Context, req *MsgSwapToERC20) (*MsgSwapToERC20Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapToERC20 not implemented") +} +func (*UnimplementedMsgServer) SwapFromERC20(ctx context.Context, req *MsgSwapFromERC20) (*MsgSwapFromERC20Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapFromERC20 not implemented") +} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) DeployERC20(ctx context.Context, req *MsgDeployERC20) (*MsgDeployERC20Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeployERC20 not implemented") +} +func (*UnimplementedMsgServer) UpgradeERC20(ctx context.Context, req *MsgUpgradeERC20) (*MsgUpgradeERC20Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeERC20 not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -927,6 +1328,42 @@ func _Msg_SwapFeeToken_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_SwapToERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwapToERC20) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SwapToERC20(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.token.v1.Msg/SwapToERC20", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SwapToERC20(ctx, req.(*MsgSwapToERC20)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SwapFromERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwapFromERC20) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SwapFromERC20(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.token.v1.Msg/SwapFromERC20", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SwapFromERC20(ctx, req.(*MsgSwapFromERC20)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateParams) if err := dec(in); err != nil { @@ -945,6 +1382,42 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_DeployERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeployERC20) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DeployERC20(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.token.v1.Msg/DeployERC20", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DeployERC20(ctx, req.(*MsgDeployERC20)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpgradeERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpgradeERC20) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpgradeERC20(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.token.v1.Msg/UpgradeERC20", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpgradeERC20(ctx, req.(*MsgUpgradeERC20)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "irismod.token.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -973,10 +1446,26 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SwapFeeToken", Handler: _Msg_SwapFeeToken_Handler, }, + { + MethodName: "SwapToERC20", + Handler: _Msg_SwapToERC20_Handler, + }, + { + MethodName: "SwapFromERC20", + Handler: _Msg_SwapFromERC20_Handler, + }, { MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "DeployERC20", + Handler: _Msg_DeployERC20_Handler, + }, + { + MethodName: "UpgradeERC20", + Handler: _Msg_UpgradeERC20_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "irismod/token/v1/tx.proto", @@ -1254,10 +1743,10 @@ func (m *MsgMintToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.To) > 0 { - i -= len(m.To) - copy(dAtA[i:], m.To) - i = encodeVarintTx(dAtA, i, uint64(len(m.To))) + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintTx(dAtA, i, uint64(len(m.Receiver))) i-- dAtA[i] = 0x12 } @@ -1387,10 +1876,10 @@ func (m *MsgSwapFeeToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.Recipient) > 0 { - i -= len(m.Recipient) - copy(dAtA[i:], m.Recipient) - i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintTx(dAtA, i, uint64(len(m.Receiver))) i-- dAtA[i] = 0x12 } @@ -1503,6 +1992,285 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgDeployERC20) 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 *MsgDeployERC20) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeployERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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] = 0x2a + } + if len(m.MinUnit) > 0 { + i -= len(m.MinUnit) + copy(dAtA[i:], m.MinUnit) + i = encodeVarintTx(dAtA, i, uint64(len(m.MinUnit))) + i-- + dAtA[i] = 0x22 + } + if m.Scale != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Scale)) + i-- + dAtA[i] = 0x18 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDeployERC20Response) 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 *MsgDeployERC20Response) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeployERC20Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSwapToERC20) 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 *MsgSwapToERC20) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapToERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintTx(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgSwapToERC20Response) 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 *MsgSwapToERC20Response) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapToERC20Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSwapFromERC20) 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 *MsgSwapFromERC20) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapFromERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintTx(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.WantedAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgSwapFromERC20Response) 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 *MsgSwapFromERC20Response) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapFromERC20Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpgradeERC20) 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 *MsgUpgradeERC20) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpgradeERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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] = 0x12 + } + if len(m.Implementation) > 0 { + i -= len(m.Implementation) + copy(dAtA[i:], m.Implementation) + i = encodeVarintTx(dAtA, i, uint64(len(m.Implementation))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpgradeERC20Response) 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 *MsgUpgradeERC20Response) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpgradeERC20Response) 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 @@ -1635,7 +2403,7 @@ func (m *MsgMintToken) Size() (n int) { _ = l l = m.Coin.Size() n += 1 + l + sovTx(uint64(l)) - l = len(m.To) + l = len(m.Receiver) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1687,7 +2455,7 @@ func (m *MsgSwapFeeToken) Size() (n int) { _ = l l = m.FeePaid.Size() n += 1 + l + sovTx(uint64(l)) - l = len(m.Recipient) + l = len(m.Receiver) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1733,21 +2501,140 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { 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 *MsgIssueToken) 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 +func (m *MsgDeployERC20) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Scale != 0 { + n += 1 + sovTx(uint64(m.Scale)) + } + l = len(m.MinUnit) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDeployERC20Response) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSwapToERC20) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSwapToERC20Response) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSwapFromERC20) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.WantedAmount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSwapFromERC20Response) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpgradeERC20) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Implementation) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpgradeERC20Response) 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 *MsgIssueToken) 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 @@ -1921,11 +2808,639 @@ func (m *MsgIssueToken) Unmarshal(dAtA []byte) error { break } } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mintable", wireType) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Mintable", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Mintable = bool(v != 0) + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = 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 *MsgIssueTokenResponse) 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: MsgIssueTokenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIssueTokenResponse: 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 *MsgTransferTokenOwner) 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: MsgTransferTokenOwner: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransferTokenOwner: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SrcOwner", 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.SrcOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DstOwner", 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.DstOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = 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 *MsgTransferTokenOwnerResponse) 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: MsgTransferTokenOwnerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransferTokenOwnerResponse: 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 *MsgEditToken) 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: MsgEditToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSupply", wireType) + } + m.MaxSupply = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSupply |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mintable", 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.Mintable = github_com_irisnet_irismod_modules_token_types.Bool(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = 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 *MsgEditTokenResponse) 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: MsgEditTokenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditTokenResponse: 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 *MsgMintToken) 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: MsgMintToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", 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.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - var v int + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1935,13 +3450,25 @@ func (m *MsgIssueToken) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.Mintable = bool(v != 0) - case 8: + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } @@ -1994,7 +3521,7 @@ func (m *MsgIssueToken) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgIssueTokenResponse) Unmarshal(dAtA []byte) error { +func (m *MsgMintTokenResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2017,10 +3544,10 @@ func (m *MsgIssueTokenResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgIssueTokenResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMintTokenResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgIssueTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMintTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2044,7 +3571,7 @@ func (m *MsgIssueTokenResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgTransferTokenOwner) Unmarshal(dAtA []byte) error { +func (m *MsgBurnToken) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2067,17 +3594,17 @@ func (m *MsgTransferTokenOwner) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgTransferTokenOwner: wiretype end group for non-group") + return fmt.Errorf("proto: MsgBurnToken: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgTransferTokenOwner: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgBurnToken: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcOwner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2087,59 +3614,28 @@ func (m *MsgTransferTokenOwner) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.SrcOwner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DstOwner", 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 + if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.DstOwner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2167,7 +3663,7 @@ func (m *MsgTransferTokenOwner) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Symbol = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2190,7 +3686,7 @@ func (m *MsgTransferTokenOwner) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgTransferTokenOwnerResponse) Unmarshal(dAtA []byte) error { +func (m *MsgBurnTokenResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2213,10 +3709,10 @@ func (m *MsgTransferTokenOwnerResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgTransferTokenOwnerResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgBurnTokenResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgTransferTokenOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgBurnTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2240,7 +3736,7 @@ func (m *MsgTransferTokenOwnerResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgEditToken) Unmarshal(dAtA []byte) error { +func (m *MsgSwapFeeToken) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2263,15 +3759,48 @@ func (m *MsgEditToken) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgEditToken: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSwapFeeToken: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditToken: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSwapFeeToken: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FeePaid", 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.FeePaid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2299,11 +3828,11 @@ func (m *MsgEditToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Symbol = string(dAtA[iNdEx:postIndex]) + m.Receiver = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2328,33 +3857,147 @@ func (m *MsgEditToken) Unmarshal(dAtA []byte) error { if postIndex < 0 { return ErrInvalidLengthTx } - if postIndex > l { + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = 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 *MsgSwapFeeTokenResponse) 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: MsgSwapFeeTokenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapFeeTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeGot", 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.FeeGot.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 *MsgUpdateParams) 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 } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxSupply", wireType) - } - m.MaxSupply = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxSupply |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - case 4: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Mintable", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2382,13 +4025,13 @@ func (m *MsgEditToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Mintable = github_com_irisnet_irismod_modules_token_types.Bool(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2398,23 +4041,24 @@ func (m *MsgEditToken) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2437,7 +4081,7 @@ func (m *MsgEditToken) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgEditTokenResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2460,10 +4104,10 @@ func (m *MsgEditTokenResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgEditTokenResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2487,7 +4131,7 @@ func (m *MsgEditTokenResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMintToken) Unmarshal(dAtA []byte) error { +func (m *MsgDeployERC20) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2510,17 +4154,17 @@ func (m *MsgMintToken) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMintToken: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDeployERC20: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintToken: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDeployERC20: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2530,28 +4174,27 @@ func (m *MsgMintToken) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Symbol = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2579,11 +4222,30 @@ func (m *MsgMintToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.To = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Scale", wireType) + } + m.Scale = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Scale |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinUnit", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2611,7 +4273,39 @@ func (m *MsgMintToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + m.MinUnit = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + 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 default: iNdEx = preIndex @@ -2634,7 +4328,7 @@ func (m *MsgMintToken) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMintTokenResponse) Unmarshal(dAtA []byte) error { +func (m *MsgDeployERC20Response) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2657,10 +4351,10 @@ func (m *MsgMintTokenResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMintTokenResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDeployERC20Response: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDeployERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2684,7 +4378,7 @@ func (m *MsgMintTokenResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBurnToken) Unmarshal(dAtA []byte) error { +func (m *MsgSwapToERC20) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2707,15 +4401,15 @@ func (m *MsgBurnToken) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgBurnToken: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSwapToERC20: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnToken: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSwapToERC20: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2742,7 +4436,7 @@ func (m *MsgBurnToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2778,6 +4472,38 @@ func (m *MsgBurnToken) Unmarshal(dAtA []byte) error { } m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", 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.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2799,7 +4525,7 @@ func (m *MsgBurnToken) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBurnTokenResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSwapToERC20Response) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2822,10 +4548,10 @@ func (m *MsgBurnTokenResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgBurnTokenResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSwapToERC20Response: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSwapToERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2849,7 +4575,7 @@ func (m *MsgBurnTokenResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSwapFeeToken) Unmarshal(dAtA []byte) error { +func (m *MsgSwapFromERC20) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2872,15 +4598,15 @@ func (m *MsgSwapFeeToken) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSwapFeeToken: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSwapFromERC20: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSwapFeeToken: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSwapFromERC20: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeePaid", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WantedAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2907,13 +4633,13 @@ func (m *MsgSwapFeeToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.FeePaid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.WantedAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2941,11 +4667,11 @@ func (m *MsgSwapFeeToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Recipient = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2973,7 +4699,7 @@ func (m *MsgSwapFeeToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Receiver = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2996,7 +4722,7 @@ func (m *MsgSwapFeeToken) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSwapFeeTokenResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSwapFromERC20Response) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3019,45 +4745,12 @@ func (m *MsgSwapFeeTokenResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSwapFeeTokenResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSwapFromERC20Response: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSwapFeeTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSwapFromERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeGot", 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.FeeGot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3079,7 +4772,7 @@ func (m *MsgSwapFeeTokenResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { +func (m *MsgUpgradeERC20) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3102,15 +4795,15 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpgradeERC20: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpgradeERC20: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Implementation", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3138,13 +4831,13 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.Implementation = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3154,24 +4847,23 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3194,7 +4886,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpgradeERC20Response) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3217,10 +4909,10 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpgradeERC20Response: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpgradeERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/modules/token/types/v1beta1/msgs.go b/modules/token/types/v1beta1/msgs.go index d6f9de4b..ae46b4d5 100644 --- a/modules/token/types/v1beta1/msgs.go +++ b/modules/token/types/v1beta1/msgs.go @@ -1,8 +1,10 @@ package v1beta1 import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + tokentypes "github.com/irisnet/irismod/modules/token/types" ) @@ -56,7 +58,7 @@ func (msg MsgIssueToken) Type() string { return TypeMsgIssueToken } func (msg MsgIssueToken) ValidateBasic() error { owner, err := sdk.AccAddressFromBech32(msg.Owner) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } return NewToken( @@ -121,12 +123,12 @@ func (msg MsgTransferTokenOwner) GetSigners() []sdk.AccAddress { func (msg MsgTransferTokenOwner) ValidateBasic() error { srcOwner, err := sdk.AccAddressFromBech32(msg.SrcOwner) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid source owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid source owner address (%s)", err) } dstOwner, err := sdk.AccAddressFromBech32(msg.DstOwner) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid destination owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid destination owner address (%s)", err) } // check if the `DstOwner` is same as the original owner @@ -188,7 +190,7 @@ func (msg MsgEditToken) GetSigners() []sdk.AccAddress { func (msg MsgEditToken) ValidateBasic() error { // check owner if _, err := sdk.AccAddressFromBech32(msg.Owner); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } if err := tokentypes.ValidateName(msg.Name); err != nil { @@ -236,13 +238,13 @@ func (msg MsgMintToken) GetSigners() []sdk.AccAddress { func (msg MsgMintToken) ValidateBasic() error { // check the owner if _, err := sdk.AccAddressFromBech32(msg.Owner); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } // check the reception if len(msg.To) > 0 { if _, err := sdk.AccAddressFromBech32(msg.To); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid mint reception address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid mint reception address (%s)", err) } } @@ -290,7 +292,7 @@ func (msg MsgBurnToken) GetSigners() []sdk.AccAddress { func (msg MsgBurnToken) ValidateBasic() error { // check the owner if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } if err := tokentypes.ValidateAmount(msg.Amount); err != nil { diff --git a/modules/token/types/v1beta1/msgs_test.go b/modules/token/types/v1beta1/msgs_test.go index 43f7fff7..2554258a 100644 --- a/modules/token/types/v1beta1/msgs_test.go +++ b/modules/token/types/v1beta1/msgs_test.go @@ -8,6 +8,7 @@ import ( "github.com/cometbft/cometbft/crypto/tmhash" sdk "github.com/cosmos/cosmos-sdk/types" + tokentypes "github.com/irisnet/irismod/modules/token/types" ) diff --git a/modules/token/types/v1beta1/token.go b/modules/token/types/v1beta1/token.go index 1e44d4d5..2bc80bcc 100644 --- a/modules/token/types/v1beta1/token.go +++ b/modules/token/types/v1beta1/token.go @@ -6,8 +6,10 @@ import ( "github.com/cosmos/gogoproto/proto" "gopkg.in/yaml.v2" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + tokentypes "github.com/irisnet/irismod/modules/token/types" ) @@ -114,7 +116,7 @@ func (t Token) ToMainCoin(coin sdk.Coin) (sdk.DecCoin, error) { return sdk.NewDecCoinFromDec( coin.Denom, sdk.ZeroDec(), - ), sdkerrors.Wrapf( + ), errorsmod.Wrapf( tokentypes.ErrTokenNotExists, "token not match", ) @@ -136,7 +138,7 @@ func (t Token) ToMinCoin(coin sdk.DecCoin) (newCoin sdk.Coin, err error) { return sdk.NewCoin( coin.Denom, sdk.ZeroInt(), - ), sdkerrors.Wrapf( + ), errorsmod.Wrapf( tokentypes.ErrTokenNotExists, "token not match", ) @@ -156,7 +158,7 @@ func (t Token) ToMinCoin(coin sdk.DecCoin) (newCoin sdk.Coin, err error) { func (t Token) Validate() error { if len(t.Owner) > 0 { if _, err := sdk.AccAddressFromBech32(t.Owner); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) } } if err := tokentypes.ValidateName(t.Name); err != nil { @@ -172,7 +174,7 @@ func (t Token) Validate() error { return err } if t.MaxSupply < t.InitialSupply { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( tokentypes.ErrInvalidMaxSupply, "invalid token max supply %d, only accepts value [%d, %d]", t.MaxSupply, diff --git a/modules/token/types/v1beta1/token_test.go b/modules/token/types/v1beta1/token_test.go index e0ec6da3..4b3da526 100644 --- a/modules/token/types/v1beta1/token_test.go +++ b/modules/token/types/v1beta1/token_test.go @@ -7,6 +7,7 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + tokentypes "github.com/irisnet/irismod/modules/token/types" ) diff --git a/modules/token/types/validation.go b/modules/token/types/validation.go index 7e91307f..24d477b9 100644 --- a/modules/token/types/validation.go +++ b/modules/token/types/validation.go @@ -6,6 +6,7 @@ import ( "regexp" "strings" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -49,12 +50,15 @@ var ( regexpMinUintFmt = fmt.Sprintf("^[a-z][a-z0-9]{%d,%d}$", MinimumMinUnitLen-1, MaximumMinUnitLen-1) regexpMinUint = regexp.MustCompile(regexpMinUintFmt).MatchString + + regexpEthAddressStr = "^0x[0-9a-f]{40}$" + regexpEthAddress = regexp.MustCompile(regexpEthAddressStr).MatchString ) // ValidateInitialSupply verifies whether the initial supply is legal func ValidateInitialSupply(initialSupply uint64) error { if initialSupply > MaximumInitSupply { - return sdkerrors.Wrapf(ErrInvalidInitSupply, "invalid token initial supply %d, only accepts value [0, %d]", initialSupply, MaximumInitSupply) + return errorsmod.Wrapf(ErrInvalidInitSupply, "invalid token initial supply %d, only accepts value [0, %d]", initialSupply, MaximumInitSupply) } return nil } @@ -62,7 +66,7 @@ func ValidateInitialSupply(initialSupply uint64) error { // ValidateName verifies whether the given name is legal func ValidateName(name string) error { if len(name) == 0 || len(name) > MaximumNameLen { - return sdkerrors.Wrapf(ErrInvalidName, "invalid token name %s, only accepts length (0, %d]", name, MaximumNameLen) + return errorsmod.Wrapf(ErrInvalidName, "invalid token name %s, only accepts length (0, %d]", name, MaximumNameLen) } return nil } @@ -70,7 +74,7 @@ func ValidateName(name string) error { // ValidateScale verifies whether the given scale is legal func ValidateScale(scale uint32) error { if scale > MaximumScale { - return sdkerrors.Wrapf(ErrInvalidScale, "invalid token scale %d, only accepts value [0, %d]", scale, MaximumScale) + return errorsmod.Wrapf(ErrInvalidScale, "invalid token scale %d, only accepts value [0, %d]", scale, MaximumScale) } return nil } @@ -78,7 +82,7 @@ func ValidateScale(scale uint32) error { // ValidateMinUnit checks if the given min unit is valid func ValidateMinUnit(minUnit string) error { if !regexpMinUint(minUnit) { - return sdkerrors.Wrapf(ErrInvalidMinUnit, "invalid minUnit: %s, only accepts english lowercase letters and numbers, length [%d, %d], and begin with an english letter, regexp: %s", minUnit, MinimumMinUnitLen, MaximumMinUnitLen, regexpMinUintFmt) + return errorsmod.Wrapf(ErrInvalidMinUnit, "invalid minUnit: %s, only accepts english lowercase letters and numbers, length [%d, %d], and begin with an english letter, regexp: %s", minUnit, MinimumMinUnitLen, MaximumMinUnitLen, regexpMinUintFmt) } return ValidateKeywords(minUnit) } @@ -86,7 +90,7 @@ func ValidateMinUnit(minUnit string) error { // ValidateSymbol checks if the given symbol is valid func ValidateSymbol(symbol string) error { if !regexpSymbol(symbol) { - return sdkerrors.Wrapf(ErrInvalidSymbol, "invalid symbol: %s, only accepts english lowercase letters and numbers, length [%d, %d], and begin with an english letter, regexp: %s", symbol, MinimumSymbolLen, MaximumSymbolLen, regexpSymbolFmt) + return errorsmod.Wrapf(ErrInvalidSymbol, "invalid symbol: %s, only accepts english lowercase letters and numbers, length [%d, %d], and begin with an english letter, regexp: %s", symbol, MinimumSymbolLen, MaximumSymbolLen, regexpSymbolFmt) } return ValidateKeywords(symbol) } @@ -94,7 +98,7 @@ func ValidateSymbol(symbol string) error { // ValidateKeywords checks if the given denom begins with `TokenKeywords` func ValidateKeywords(denom string) error { if regexpKeyword(denom) { - return sdkerrors.Wrapf(ErrInvalidSymbol, "invalid token: %s, can not begin with keyword: (%s)", denom, keywords) + return errorsmod.Wrapf(ErrInvalidSymbol, "invalid token: %s, can not begin with keyword: (%s)", denom, keywords) } return nil } @@ -102,7 +106,7 @@ func ValidateKeywords(denom string) error { // ValidateAmount checks if the given denom begins with `TokenKeywords` func ValidateAmount(amount uint64) error { if amount == 0 { - return sdkerrors.Wrapf(ErrInvalidMaxSupply, "invalid token amount %d, only accepts value (0, %d]", amount, uint64(MaximumMaxSupply)) + return errorsmod.Wrapf(ErrInvalidMaxSupply, "invalid token amount %d, only accepts value (0, %d]", amount, uint64(MaximumMaxSupply)) } return nil } @@ -110,7 +114,7 @@ func ValidateAmount(amount uint64) error { // ValidateCoin checks if the given coin func ValidateCoin(coin sdk.Coin) error { if !coin.IsPositive() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "invalid coin (%s)", coin.String()) + return errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid coin (%s)", coin.String()) } return ValidateMinUnit(coin.Denom) } diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..82e8428c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,18 @@ +{ + "name": "irismod", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "irismod", + "dependencies": { + "@openzeppelin/contracts": "^5.0.2" + } + }, + "node_modules/@openzeppelin/contracts": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.0.2.tgz", + "integrity": "sha512-ytPc6eLGcHHnapAZ9S+5qsdomhjo6QBHTDRRBFfTxXIpsicMhVPouPgmUPebZZZGX7vt9USA+Z+0M0dSVtSUEA==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..3da2449c --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "name": "irismod", + "dependencies": { + "@openzeppelin/contracts": "^5.0.2" + } +} diff --git a/proto/irismod/token/module/v1/module.proto b/proto/irismod/token/module/v1/module.proto index 65accab8..89c97832 100644 --- a/proto/irismod/token/module/v1/module.proto +++ b/proto/irismod/token/module/v1/module.proto @@ -7,11 +7,12 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the bank module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/irisnet/irismod/modules/token" + go_import : "github.com/irisnet/irismod/modules/token" }; string fee_collector_name = 1; - // authority defines the custom module authority. If not set, defaults to the governance module. + // authority defines the custom module authority. If not set, defaults to the + // governance module. string authority = 2; } \ No newline at end of file diff --git a/proto/irismod/token/v1/event.proto b/proto/irismod/token/v1/event.proto new file mode 100644 index 00000000..5d7416c0 --- /dev/null +++ b/proto/irismod/token/v1/event.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package irismod.token.v1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/irisnet/irismod/modules/token/types/v1"; +option (gogoproto.goproto_getters_all) = false; + +// EventDeployERC20 is an event emitted when deploying ERC20. +message EventDeployERC20 { + string symbol = 1; + string name = 2; + uint32 scale = 3; + string min_unit = 4; + string contract = 5; +} + +// EventSwapToERC20 is an event emitted when swapping token from native token to +// ERC20. +message EventSwapToERC20 { + cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false ]; + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string receiver = 3; + string to_contract = 4; +} + +// EventSwapFromERC20 is an event emitted when swapping token from ERC20 to +// native token. +message EventSwapFromERC20 { + cosmos.base.v1beta1.Coin wanted_amount = 1; + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string receiver = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string from_contract = 4; +} diff --git a/proto/irismod/token/v1/query.proto b/proto/irismod/token/v1/query.proto index a2cb4dd0..97272f59 100644 --- a/proto/irismod/token/v1/query.proto +++ b/proto/irismod/token/v1/query.proto @@ -8,22 +8,25 @@ import "cosmos/query/v1/query.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "google/protobuf/any.proto"; +import "amino/amino.proto"; import "irismod/token/v1/token.proto"; option go_package = "github.com/irisnet/irismod/modules/token/types/v1"; // Query creates service with token as RPC service Query { - // Token returns token with token name - rpc Token(QueryTokenRequest) returns (QueryTokenResponse) { - option (cosmos.query.v1.module_query_safe) = true; - option (google.api.http).get = "/irismod/token/v1/tokens/{denom}"; - } // Tokens returns the token list rpc Tokens(QueryTokensRequest) returns (QueryTokensResponse) { option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/irismod/token/v1/tokens"; } + + // Token returns token with token name + rpc Token(QueryTokenRequest) returns (QueryTokenResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/irismod/token/v1/tokens/{denom=**}"; + } + // Fees returns the fees to issue or mint a token rpc Fees(QueryFeesRequest) returns (QueryFeesResponse) { option (cosmos.query.v1.module_query_safe) = true; @@ -39,10 +42,17 @@ service Query { option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/irismod/token/v1/total_burn"; } + // Balances queries the balance of the specified token (including erc20 + // balance) + rpc Balances(QueryBalancesRequest) returns (QueryBalancesResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/irismod/token/v1/balances/{address}/{denom=**}"; + } } // QueryTokenRequest is request type for the Query/Token RPC method -message QueryTokenRequest { string denom = 1; } +message QueryTokenRequest { string denom = 1 ; } // QueryTokenResponse is response type for the Query/Token RPC method message QueryTokenResponse { @@ -98,3 +108,20 @@ message QueryTotalBurnResponse { repeated cosmos.base.v1beta1.Coin burned_coins = 1 [ (gogoproto.nullable) = false ]; } + +// QueryBalancesRequest is request type for the Query/Balances RPC method +message QueryBalancesRequest { + string denom = 1; + // address is the address to query balances for. + string address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// QueryBalancesResponse is response type for the Query/Balances RPC method +message QueryBalancesResponse { + // balances is the balances of all the coins. + repeated cosmos.base.v1beta1.Coin balances = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} diff --git a/proto/irismod/token/v1/token.proto b/proto/irismod/token/v1/token.proto index 64c993f2..4c202201 100644 --- a/proto/irismod/token/v1/token.proto +++ b/proto/irismod/token/v1/token.proto @@ -19,6 +19,7 @@ message Token { uint64 max_supply = 6; bool mintable = 7; string owner = 8; + string contract = 9; } // Params defines token module's parameters @@ -37,4 +38,7 @@ message Params { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + + bool enable_erc20 = 4; + string beacon = 5; } \ No newline at end of file diff --git a/proto/irismod/token/v1/tx.proto b/proto/irismod/token/v1/tx.proto index 4dab87a7..67cfc9de 100644 --- a/proto/irismod/token/v1/tx.proto +++ b/proto/irismod/token/v1/tx.proto @@ -30,14 +30,29 @@ service Msg { rpc TransferTokenOwner(MsgTransferTokenOwner) returns (MsgTransferTokenOwnerResponse); - // SwapFeeToken defines a method for swap some fee token + // SwapFeeToken defines a method for swapping between IRIS and ERIS rpc SwapFeeToken(MsgSwapFeeToken) returns (MsgSwapFeeTokenResponse); + // SwapToERC20 defines a method for swapping some native token to its ERC20 + // counterpart + rpc SwapToERC20(MsgSwapToERC20) returns (MsgSwapToERC20Response); + + // SwapFromERC20 defines a method for swapping some ERC20 token to its native + // counterpart + rpc SwapFromERC20(MsgSwapFromERC20) returns (MsgSwapFromERC20Response); + // UpdateParams defines a governance operation for updating the token // module parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // DeployERC20 defines a governance operation for deploying an ERC20 contract + // that binds to a native token + rpc DeployERC20(MsgDeployERC20) returns (MsgDeployERC20Response); + + // UpgradeERC20 defines a governance operation for upgrading an ERC20 contract + rpc UpgradeERC20(MsgUpgradeERC20) returns (MsgUpgradeERC20Response); } // MsgIssueToken defines an SDK message for issuing a new token @@ -91,7 +106,7 @@ message MsgMintToken { option (cosmos.msg.v1.signer) = "owner"; cosmos.base.v1beta1.Coin coin = 1 [ (gogoproto.nullable) = false ]; - string to = 2; + string receiver = 2; string owner = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } @@ -114,7 +129,7 @@ message MsgSwapFeeToken { option (cosmos.msg.v1.signer) = "sender"; cosmos.base.v1beta1.Coin fee_paid = 1 [ (gogoproto.nullable) = false ]; - string recipient = 2; + string receiver = 2; string sender = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } @@ -143,4 +158,52 @@ message MsgUpdateParams { // MsgUpdateParams message. // // Since: cosmos-sdk 0.47 -message MsgUpdateParamsResponse {} \ No newline at end of file +message MsgUpdateParamsResponse {} + +// MsgDeployERC20 defines an SDK message for DeployERC20 +message MsgDeployERC20 { + string symbol = 1; + string name = 2; + uint32 scale = 3; + string min_unit = 4; + string authority = 5 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgDeployERC20Response defines the Msg/DeployERC20 response type +message MsgDeployERC20Response {} + +// MsgSwapToERC20 defines an SDK message for SwapToERC20 +message MsgSwapToERC20 { + option (cosmos.msg.v1.signer) = "sender"; + + cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false ]; + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string receiver = 3; +} + +// MsgSwapToERC20Response defines the Msg/SwapToERC20 response type +message MsgSwapToERC20Response {} + +// MsgSwapFromERC20 defines an SDK message for SwapFromERC20 +message MsgSwapFromERC20 { + option (cosmos.msg.v1.signer) = "sender"; + + cosmos.base.v1beta1.Coin wanted_amount = 1 [ (gogoproto.nullable) = false ]; + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string receiver = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgSwapFromERC20Response defines the Msg/SwapFromERC20 response type +message MsgSwapFromERC20Response {} + +// MsgUpgradeERC20 defines an SDK message for UpgradeERC20 +message MsgUpgradeERC20 { + option (cosmos.msg.v1.signer) = "authority"; + + // implementation is the new erc20 contract address + string implementation = 1; + string authority = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgUpgradeERC20Response defines the Msg/UpgradeERC20 response type +message MsgUpgradeERC20Response {} \ No newline at end of file diff --git a/simapp/app_v2.go b/simapp/app_v2.go index 6d96b362..6ee3e471 100644 --- a/simapp/app_v2.go +++ b/simapp/app_v2.go @@ -104,6 +104,8 @@ import ( "github.com/irisnet/irismod/modules/token" tokenkeeper "github.com/irisnet/irismod/modules/token/keeper" tokentypes "github.com/irisnet/irismod/modules/token/types" + + "github.com/irisnet/irismod/simapp/mocks" ) var ( @@ -277,6 +279,10 @@ func NewSimApp( // For providing a custom inflation function for x/mint add here your // custom function that implements the minttypes.InflationCalculationFn // interface. + + // For providing a mock evm function for token module + mocks.ProvideEVMKeeper(), + mocks.ProvideICS20Keeper(), ), ) ) diff --git a/simapp/export.go b/simapp/export.go index 753be0cc..5bdef6cb 100644 --- a/simapp/export.go +++ b/simapp/export.go @@ -6,6 +6,7 @@ import ( "log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/irisnet/irismod/modules/htlc" "github.com/irisnet/irismod/modules/oracle" "github.com/irisnet/irismod/modules/random" diff --git a/simapp/mocks/depinject.go b/simapp/mocks/depinject.go new file mode 100644 index 00000000..2ba691b4 --- /dev/null +++ b/simapp/mocks/depinject.go @@ -0,0 +1,25 @@ +package mocks + +import ( + "github.com/ethereum/go-ethereum/common" + + tokentypes "github.com/irisnet/irismod/modules/token/types" +) + +// ProvideEVMKeeper returns an instance of tokentypes.EVMKeeper. +// +// No parameters. +// Returns a tokentypes.EVMKeeper. +func ProvideEVMKeeper() tokentypes.EVMKeeper { + return &evm{ + erc20s: make(map[common.Address]*erc20), + } +} + +// ProvideICS20Keeper returns an instance of tokentypes.ICS20Keeper. +// +// No parameters. +// Returns a tokentypes.ICS20Keeper. +func ProvideICS20Keeper() tokentypes.ICS20Keeper { + return &transferKeeper{} +} diff --git a/simapp/mocks/evm.go b/simapp/mocks/evm.go new file mode 100644 index 00000000..89e6fc8b --- /dev/null +++ b/simapp/mocks/evm.go @@ -0,0 +1,152 @@ +package mocks + +import ( + "context" + "fmt" + "math/big" + + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/crypto" + + "github.com/irisnet/irismod/contracts" + tokentypes "github.com/irisnet/irismod/modules/token/types" + "github.com/irisnet/irismod/types" +) + +var ( + _ tokentypes.EVMKeeper = (*evm)(nil) + _ tokentypes.ICS20Keeper = (*transferKeeper)(nil) +) + +type evm struct { + erc20s map[common.Address]*erc20 +} + +// ApplyMessage implements types.EVMKeeper. +func (e *evm) ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLogger, commit bool) (*types.Result, error) { + isCreate := msg.To() == nil + if isCreate { + contractAddr := crypto.CreateAddress(msg.From(), msg.Nonce()) + + data := msg.Data()[len(contracts.TokenProxyContract.Bin):] + args, err := contracts.TokenProxyContract.ABI.Constructor.Inputs.Unpack(data) + if err != nil { + return nil, err + } + + data = args[1].([]byte) + data = data[4:] + args, err = contracts.ERC20TokenContract.ABI.Methods[contracts.MethodInitialize].Inputs.Unpack(data) + if err != nil { + return nil, err + } + + name, _ := args[0].(string) + symbol, _ := args[1].(string) + scale, _ := args[2].(uint8) + e.erc20s[contractAddr] = &erc20{ + address: contractAddr, + scale: scale, + name: name, + symbol: symbol, + balance: make(map[common.Address]*big.Int), + } + return &types.Result{ + Hash: contractAddr.Hex(), + }, nil + } + + erc20Contract, ok := e.erc20s[*msg.To()] + if !ok { + return nil, fmt.Errorf("erc20 contract not found") + } + return e.dispatch(erc20Contract, msg.Data()) +} + +// ChainID implements types.EVMKeeper. +func (e *evm) ChainID() *big.Int { + return big.NewInt(16688) +} + +// EstimateGas implements types.EVMKeeper. +func (e *evm) EstimateGas(ctx context.Context, req *types.EthCallRequest) (uint64, error) { + return 3000000, nil +} + +// SupportedKey implements types.EVMKeeper. +func (e *evm) SupportedKey(pubKey cryptotypes.PubKey) bool { + return true +} + +func (e *evm) dispatch(contract *erc20, data []byte) (*types.Result, error) { + method, err := contracts.ERC20TokenContract.ABI.MethodById(data[0:4]) + if err != nil { + return nil, err + } + + ret, err := contract.call(method, data[4:]) + if err != nil { + return nil, err + } + return &types.Result{ + Hash: contract.address.Hex(), + Ret: ret, + }, nil +} + +type erc20 struct { + address common.Address + scale uint8 + name, symbol string + + balance map[common.Address]*big.Int +} + +func (erc20 erc20) call(method *abi.Method, data []byte) ([]byte, error) { + args, err := method.Inputs.Unpack(data) + if err != nil { + return nil, err + } + + switch method.Name { + case "name": + return method.Outputs.Pack(erc20.name) + case "symbol": + return method.Outputs.Pack(erc20.symbol) + case "decimals": + return method.Outputs.Pack(erc20.scale) + case "balanceOf": + balance, ok := erc20.balance[args[0].(common.Address)] + if !ok { + return method.Outputs.Pack(big.NewInt(0)) + } + return method.Outputs.Pack(balance) + case "mint": + to := args[0].(common.Address) + balance, ok := erc20.balance[args[0].(common.Address)] + if !ok { + balance = big.NewInt(0) + } + erc20.balance[to] = new(big.Int).Add(balance, args[1].(*big.Int)) + return nil, nil + case "burn": + from := args[0].(common.Address) + erc20.balance[from] = new(big.Int).Sub(erc20.balance[from], args[1].(*big.Int)) + return nil, nil + default: + return nil, fmt.Errorf("unknown method %s", method.Name) + } +} + +type transferKeeper struct{} + +// HasTrace implements types.ICS20Keeper. +func (t *transferKeeper) HasTrace(ctx sdk.Context, denom string) bool { + return true +} diff --git a/types/evm.go b/types/evm.go new file mode 100644 index 00000000..70b8e2a1 --- /dev/null +++ b/types/evm.go @@ -0,0 +1,168 @@ +package types + +import ( + "encoding/hex" + "encoding/json" + "fmt" + "math/big" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" +) + +const ( + // DefaultGasCap is the default gas cap for eth_call + DefaultGasCap uint64 = 25000000 +) + +// TransactionArgs represents the arguments to construct a new transaction +// or a message call using JSON-RPC. +type TransactionArgs struct { + From *common.Address `json:"from"` + To *common.Address `json:"to"` + Gas *hexutil.Uint64 `json:"gas"` + GasPrice *hexutil.Big `json:"gasPrice"` + MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` + MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` + Value *hexutil.Big `json:"value"` + Nonce *hexutil.Uint64 `json:"nonce"` + + // We accept "data" and "input" for backwards-compatibility reasons. + // "input" is the newer name and should be preferred by clients. + Data *hexutil.Bytes `json:"data"` + Input *hexutil.Bytes `json:"input"` + + // Introduced by AccessListTxType transaction. + AccessList *ethtypes.AccessList `json:"accessList,omitempty"` + ChainID *hexutil.Big `json:"chainId,omitempty"` +} + +// EthCallRequest represents the arguments to the eth_call RPC +type EthCallRequest struct { + // args uses the same json format as the json rpc api. + Args []byte `json:"args,omitempty"` + // gas_cap defines the default gas cap to be used + GasCap uint64 `json:"gas_cap,omitempty"` + // proposer_address of the requested block in hex format + ProposerAddress sdk.ConsAddress `json:"proposer_address,omitempty"` + // chain_id is the eip155 chain id parsed from the requested block header + ChainID int64 `json:"chain_id,omitempty"` +} + +// Result represents the result of a contract execution +type Result struct { + // hash of the ethereum transaction in hex format. This hash differs from the + // Tendermint sha256 hash of the transaction bytes. See + // https://github.com/tendermint/tendermint/issues/6539 for reference + Hash string + // logs contains the transaction hash and the proto-compatible ethereum + // logs. + Logs []*ethtypes.Log + // ret is the returned data from evm function (result or data supplied with revert + // opcode) + Ret []byte + // vm_error is the error returned by vm execution + VMError string + // gas_used specifies how much gas was consumed by the transaction + GasUsed uint64 +} + +// Failed returns if the contract execution failed in vm errors +func (r *Result) Failed() bool { + return len(r.VMError) > 0 +} + +// Return is a helper function to help caller distinguish between revert reason +// and function return. Return returns the data after execution if no error occurs. +func (r *Result) Return() []byte { + if r.Failed() { + return nil + } + return common.CopyBytes(r.Ret) +} + +// Revert returns the concrete revert reason if the execution is aborted by `REVERT` +// opcode. Note the reason can be nil if no data supplied with revert opcode. +func (r *Result) Revert() []byte { + if r.VMError != vm.ErrExecutionReverted.Error() { + return nil + } + return common.CopyBytes(r.Ret) +} + +var _ vm.EVMLogger = &NoOpTracer{} + +// NoOpTracer is an empty implementation of vm.Tracer interface +type NoOpTracer struct{} + +// NewNoOpTracer creates a no-op vm.Tracer +func NewNoOpTracer() *NoOpTracer { + return &NoOpTracer{} +} + +// CaptureStart implements vm.Tracer interface +func (dt NoOpTracer) CaptureStart(env *vm.EVM, + from common.Address, + to common.Address, + create bool, + input []byte, + gas uint64, + value *big.Int) { +} + +// CaptureState implements vm.Tracer interface +func (dt NoOpTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) { +} + +// CaptureFault implements vm.Tracer interface +func (dt NoOpTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error) { +} + +// CaptureEnd implements vm.Tracer interface +func (dt NoOpTracer) CaptureEnd(output []byte, gasUsed uint64, tm time.Duration, err error) {} + +// CaptureEnter implements vm.Tracer interface +func (dt NoOpTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) { +} + +// CaptureExit implements vm.Tracer interface +func (dt NoOpTracer) CaptureExit(output []byte, gasUsed uint64, err error) {} + +// CaptureTxStart implements vm.Tracer interface +func (dt NoOpTracer) CaptureTxStart(gasLimit uint64) {} + +// CaptureTxEnd implements vm.Tracer interface +func (dt NoOpTracer) CaptureTxEnd(restGas uint64) {} + +// HexString is a byte array that serializes to hex +type HexString []byte + +// MarshalJSON serializes ByteArray to hex +func (s HexString) MarshalJSON() ([]byte, error) { + return json.Marshal(fmt.Sprintf("%x", string(s))) +} + +// UnmarshalJSON deserializes ByteArray to hex +func (s *HexString) UnmarshalJSON(data []byte) error { + var x string + if err := json.Unmarshal(data, &x); err != nil { + return err + } + str, err := hex.DecodeString(x) + if err != nil { + return err + } + *s = str + return nil +} + +// CompiledContract contains compiled bytecode and abi +type CompiledContract struct { + ABI abi.ABI + Bin HexString +}