From 58871957a8e63feffe7dc7fe0e48722d21ddc164 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:58:14 +0800 Subject: [PATCH] feat: wrapped-a0gi-base module --- app/app.go | 3 +- .../interfaces/contracts/IWrappedA0GIBase.sol | 7 +- .../wrapped-a0gi-base/IWrappedA0GIBase.json | 13 + precompiles/wrapped-a0gi-base/contract.go | 23 +- proto/zgc/wrappeda0gibase/genesis.proto | 2 +- proto/zgc/wrappeda0gibase/query.proto | 15 +- proto/zgc/wrappeda0gibase/tx.proto | 16 +- x/wrapped-a0gi-base/genesis.go | 7 +- x/wrapped-a0gi-base/keeper/grpc_query.go | 25 +- x/wrapped-a0gi-base/keeper/keeper.go | 47 +- x/wrapped-a0gi-base/keeper/msg_server.go | 92 +++- x/wrapped-a0gi-base/types/errors.go | 3 +- x/wrapped-a0gi-base/types/genesis.go | 14 +- x/wrapped-a0gi-base/types/genesis.pb.go | 50 ++- x/wrapped-a0gi-base/types/keys.go | 15 + x/wrapped-a0gi-base/types/msg.go | 22 - x/wrapped-a0gi-base/types/query.pb.go | 422 ++++++++++++++++-- x/wrapped-a0gi-base/types/query.pb.gw.go | 65 +++ x/wrapped-a0gi-base/types/tx.pb.go | 186 ++++---- 19 files changed, 815 insertions(+), 212 deletions(-) diff --git a/app/app.go b/app/app.go index e558b416..95eb8720 100644 --- a/app/app.go +++ b/app/app.go @@ -210,6 +210,7 @@ var ( bep3types.ModuleName: {authtypes.Burner, authtypes.Minter}, minttypes.ModuleName: {authtypes.Minter}, precisebanktypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for reserve account to back fractional amounts + wrappeda0gibasetypes.ModuleName: {authtypes.Minter, authtypes.Burner}, } ) @@ -519,7 +520,7 @@ func NewApp( } precompiles[stakingPrecompile.Address()] = stakingPrecompile // wrapped wrapped a0gi base - app.wrappeda0gibaseKeeper = wrappeda0gibasekeeper.NewKeeper(keys[wrappeda0gibasetypes.StoreKey], appCodec, govAuthAddrStr) + app.wrappeda0gibaseKeeper = wrappeda0gibasekeeper.NewKeeper(keys[wrappeda0gibasetypes.StoreKey], appCodec, app.precisebankKeeper, govAuthAddrStr) wrappeda0gibasePrecompile, err := wrappeda0gibaseprecompile.NewWrappedA0giBasePrecompile(app.wrappeda0gibaseKeeper) if err != nil { panic(fmt.Sprintf("initialize wrapped a0gi base precompile failed: %v", err)) diff --git a/precompiles/interfaces/contracts/IWrappedA0GIBase.sol b/precompiles/interfaces/contracts/IWrappedA0GIBase.sol index eaf5a246..7f22a024 100644 --- a/precompiles/interfaces/contracts/IWrappedA0GIBase.sol +++ b/precompiles/interfaces/contracts/IWrappedA0GIBase.sol @@ -13,10 +13,15 @@ interface IWrappedA0GIBase { /** * @dev set the wA0GI address. * It is designed to be called by governance module only so it's not implemented at EVM precompile side. - * @param + * @param addr address of wA0GI */ // function setWA0GI(address addr) external; + /** + * @dev get the wA0GI address. + */ + function getWA0GI() external returns (address); + /** * @dev set the cap for a minter. * It is designed to be called by governance module only so it's not implemented at EVM precompile side. diff --git a/precompiles/wrapped-a0gi-base/IWrappedA0GIBase.json b/precompiles/wrapped-a0gi-base/IWrappedA0GIBase.json index 2d051720..89dae14b 100644 --- a/precompiles/wrapped-a0gi-base/IWrappedA0GIBase.json +++ b/precompiles/wrapped-a0gi-base/IWrappedA0GIBase.json @@ -17,6 +17,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "getWA0GI", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/precompiles/wrapped-a0gi-base/contract.go b/precompiles/wrapped-a0gi-base/contract.go index 9eccaf96..09cc37e0 100644 --- a/precompiles/wrapped-a0gi-base/contract.go +++ b/precompiles/wrapped-a0gi-base/contract.go @@ -30,7 +30,7 @@ var ( // Wrappeda0gibaseMetaData contains all meta data concerning the Wrappeda0gibase contract. var Wrappeda0gibaseMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"}],\"name\":\"minterSupply\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"cap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"internalType\":\"structSupply\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWA0GI\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"}],\"name\":\"minterSupply\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"cap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"internalType\":\"structSupply\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // Wrappeda0gibaseABI is the input ABI used to generate the binding from. @@ -231,6 +231,27 @@ func (_Wrappeda0gibase *Wrappeda0gibaseTransactorSession) Burn(minter common.Add return _Wrappeda0gibase.Contract.Burn(&_Wrappeda0gibase.TransactOpts, minter, amount) } +// GetWA0GI is a paid mutator transaction binding the contract method 0xa9283a7a. +// +// Solidity: function getWA0GI() returns(address) +func (_Wrappeda0gibase *Wrappeda0gibaseTransactor) GetWA0GI(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Wrappeda0gibase.contract.Transact(opts, "getWA0GI") +} + +// GetWA0GI is a paid mutator transaction binding the contract method 0xa9283a7a. +// +// Solidity: function getWA0GI() returns(address) +func (_Wrappeda0gibase *Wrappeda0gibaseSession) GetWA0GI() (*types.Transaction, error) { + return _Wrappeda0gibase.Contract.GetWA0GI(&_Wrappeda0gibase.TransactOpts) +} + +// GetWA0GI is a paid mutator transaction binding the contract method 0xa9283a7a. +// +// Solidity: function getWA0GI() returns(address) +func (_Wrappeda0gibase *Wrappeda0gibaseTransactorSession) GetWA0GI() (*types.Transaction, error) { + return _Wrappeda0gibase.Contract.GetWA0GI(&_Wrappeda0gibase.TransactOpts) +} + // Mint is a paid mutator transaction binding the contract method 0xc6c3bbe6. // // Solidity: function mint(address minter, address to, uint256 amount) returns() diff --git a/proto/zgc/wrappeda0gibase/genesis.proto b/proto/zgc/wrappeda0gibase/genesis.proto index 66fd833a..3915a898 100644 --- a/proto/zgc/wrappeda0gibase/genesis.proto +++ b/proto/zgc/wrappeda0gibase/genesis.proto @@ -11,5 +11,5 @@ option go_package = "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"; // GenesisState defines the wrapped a0gi base module's genesis state. message GenesisState { // address of wrapped a0gi contract - string wrapped_a0gi_address = 1; + bytes wrapped_a0gi_address = 1; } diff --git a/proto/zgc/wrappeda0gibase/query.proto b/proto/zgc/wrappeda0gibase/query.proto index 97958902..a242ad39 100644 --- a/proto/zgc/wrappeda0gibase/query.proto +++ b/proto/zgc/wrappeda0gibase/query.proto @@ -12,16 +12,25 @@ option (gogoproto.goproto_getters_all) = false; // Query defines the gRPC querier service for the wrapped a0gi base module service Query { + rpc GetWA0GI(GetWA0GIRequest) returns (GetWA0GIResponse) { + option (google.api.http).get = "/0g/wrapped-a0gi-base/get-wa0gi"; + } rpc MinterSupply(MinterSupplyRequest) returns (MinterSupplyResponse) { option (google.api.http).get = "/0g/wrapped-a0gi-base/minter-supply"; } } +message GetWA0GIRequest {} + +message GetWA0GIResponse { + bytes address = 1; +} + message MinterSupplyRequest { - string address = 1; + bytes address = 1; } message MinterSupplyResponse { - string cap = 1; - string supply = 2; + bytes cap = 1; // big endian + bytes supply = 2; // big endian } diff --git a/proto/zgc/wrappeda0gibase/tx.proto b/proto/zgc/wrappeda0gibase/tx.proto index 6f247d93..61fed0f7 100644 --- a/proto/zgc/wrappeda0gibase/tx.proto +++ b/proto/zgc/wrappeda0gibase/tx.proto @@ -18,30 +18,30 @@ service Msg { message MsgSetWA0GI { string authority = 1; - string address = 2; + bytes address = 2; } message MsgSetWA0GIResponse {} message MsgSetMintCap { string authority = 1; - string minter = 2; - string cap = 3; + bytes minter = 2; + bytes cap = 3; // big endian } message MsgSetMintCapResponse {} message MsgMint { - string minter = 1; - string to = 2; - string amount = 3; + bytes minter = 1; + bytes to = 2; + bytes amount = 3; // big endian } message MsgMintResponse {} message MsgBurn { - string minter = 1; - string amount = 2; + bytes minter = 1; + bytes amount = 2; // big endian } message MsgBurnResponse {} diff --git a/x/wrapped-a0gi-base/genesis.go b/x/wrapped-a0gi-base/genesis.go index 4029ed65..56da0ad5 100644 --- a/x/wrapped-a0gi-base/genesis.go +++ b/x/wrapped-a0gi-base/genesis.go @@ -6,6 +6,7 @@ import ( "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/keeper" "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" ) // InitGenesis initializes the store state from a genesis state. @@ -13,10 +14,12 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, gs types.GenesisState) { if err := gs.Validate(); err != nil { panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err)) } - panic("unimplemented") + keeper.SetWA0GIAddress(ctx, common.BytesToAddress(gs.WrappedA0GiAddress)) } // ExportGenesis returns a GenesisState for a given context and keeper. func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { - panic("unimplemented") + return &types.GenesisState{ + WrappedA0GiAddress: keeper.GetWA0GIAddress(ctx), + } } diff --git a/x/wrapped-a0gi-base/keeper/grpc_query.go b/x/wrapped-a0gi-base/keeper/grpc_query.go index cd144ac2..3164fb26 100644 --- a/x/wrapped-a0gi-base/keeper/grpc_query.go +++ b/x/wrapped-a0gi-base/keeper/grpc_query.go @@ -4,11 +4,34 @@ import ( "context" "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" ) var _ types.QueryServer = Keeper{} // MinterSupply implements types.QueryServer. func (k Keeper) MinterSupply(c context.Context, request *types.MinterSupplyRequest) (*types.MinterSupplyResponse, error) { - panic("unimplemented") + ctx := sdk.UnwrapSDKContext(c) + account := common.BytesToAddress(request.Address) + cap, err := k.getMinterCap(ctx, account) + if err != nil { + return nil, err + } + supply, err := k.getMinterSupply(ctx, account) + if err != nil { + return nil, err + } + return &types.MinterSupplyResponse{ + Cap: cap.Bytes(), + Supply: supply.Bytes(), + }, nil +} + +// GetWA0GI implements types.QueryServer. +func (k Keeper) GetWA0GI(c context.Context, request *types.GetWA0GIRequest) (*types.GetWA0GIResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + return &types.GetWA0GIResponse{ + Address: k.GetWA0GIAddress(ctx), + }, nil } diff --git a/x/wrapped-a0gi-base/keeper/keeper.go b/x/wrapped-a0gi-base/keeper/keeper.go index b20e7e0b..13a77c67 100644 --- a/x/wrapped-a0gi-base/keeper/keeper.go +++ b/x/wrapped-a0gi-base/keeper/keeper.go @@ -1,14 +1,22 @@ package keeper import ( - "github.com/cosmos/cosmos-sdk/codec" + "math/big" + "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/ethereum/go-ethereum/common" + + precisebankkeeper "github.com/0glabs/0g-chain/x/precisebank/keeper" + "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) type Keeper struct { storeKey storetypes.StoreKey cdc codec.BinaryCodec + pbkeeper precisebankkeeper.Keeper authority string // the address capable of changing signers params. Should be the gov module account } @@ -16,11 +24,48 @@ type Keeper struct { func NewKeeper( storeKey storetypes.StoreKey, cdc codec.BinaryCodec, + pbkeeper precisebankkeeper.Keeper, authority string, ) Keeper { return Keeper{ storeKey: storeKey, cdc: cdc, + pbkeeper: pbkeeper, authority: authority, } } + +func (k Keeper) SetWA0GIAddress(ctx sdk.Context, addr common.Address) { + store := ctx.KVStore(k.storeKey) + store.Set(types.WA0GIKey, addr.Bytes()) +} + +func (k Keeper) GetWA0GIAddress(ctx sdk.Context) []byte { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.WA0GIKey) + return bz +} + +func (k Keeper) setMinterCap(ctx sdk.Context, account common.Address, cap *big.Int) error { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.MinterCapKeyPrefix) + store.Set(account.Bytes(), cap.Bytes()) + return nil +} + +func (k Keeper) getMinterCap(ctx sdk.Context, account common.Address) (*big.Int, error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.MinterCapKeyPrefix) + bz := store.Get(account.Bytes()) + return new(big.Int).SetBytes(bz), nil +} + +func (k Keeper) setMinterSupply(ctx sdk.Context, account common.Address, supply *big.Int) error { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.MinterSupplyKeyPrefix) + store.Set(account.Bytes(), supply.Bytes()) + return nil +} + +func (k Keeper) getMinterSupply(ctx sdk.Context, account common.Address) (*big.Int, error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.MinterSupplyKeyPrefix) + bz := store.Get(account.Bytes()) + return new(big.Int).SetBytes(bz), nil +} diff --git a/x/wrapped-a0gi-base/keeper/msg_server.go b/x/wrapped-a0gi-base/keeper/msg_server.go index e01fa164..dc3759cc 100644 --- a/x/wrapped-a0gi-base/keeper/msg_server.go +++ b/x/wrapped-a0gi-base/keeper/msg_server.go @@ -2,37 +2,107 @@ package keeper import ( "context" + "math/big" - "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types" -) - -/* errorsmod "cosmossdk.io/errors" - "github.com/0glabs/0g-chain/crypto/bn254util" + precisebanktypes "github.com/0glabs/0g-chain/x/precisebank/types" + "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types" sdk "github.com/cosmos/cosmos-sdk/types" gov "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/ethereum/go-ethereum/common" - etherminttypes "github.com/evmos/ethermint/types" -*/ +) var _ types.MsgServer = &Keeper{} // Burn implements types.MsgServer. func (k Keeper) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.MsgBurnResponse, error) { - panic("unimplemented") + ctx := sdk.UnwrapSDKContext(goCtx) + minter := common.BytesToAddress(msg.Minter) + cap, err := k.getMinterCap(ctx, minter) + if err != nil { + return nil, err + } + supply, err := k.getMinterSupply(ctx, minter) + if err != nil { + return nil, err + } + amount := new(big.Int).SetBytes(msg.Amount) + // check & update mint supply + supply.Sub(supply, amount) + if supply.Cmp(cap) > 0 { + return nil, types.ErrInsufficientMintCap + } + if err = k.setMinterSupply(ctx, minter, supply); err != nil { + return nil, err + } + // transfer & burn + c := sdk.NewCoin(precisebanktypes.ExtendedCoinDenom, sdk.NewIntFromBigInt(amount)) + burner := sdk.AccAddress(minter.Bytes()) + if err = k.pbkeeper.SendCoinsFromAccountToModule(ctx, burner, types.ModuleName, sdk.NewCoins(c)); err != nil { + return nil, err + } + if err = k.pbkeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(c)); err != nil { + return nil, err + } + return &types.MsgBurnResponse{}, nil } // Mint implements types.MsgServer. func (k Keeper) Mint(goCtx context.Context, msg *types.MsgMint) (*types.MsgMintResponse, error) { - panic("unimplemented") + ctx := sdk.UnwrapSDKContext(goCtx) + minter := common.BytesToAddress(msg.Minter) + cap, err := k.getMinterCap(ctx, minter) + if err != nil { + return nil, err + } + supply, err := k.getMinterSupply(ctx, minter) + if err != nil { + return nil, err + } + amount := new(big.Int).SetBytes(msg.Amount) + // check & update mint supply + supply.Add(supply, amount) + if supply.Cmp(cap) > 0 { + return nil, types.ErrInsufficientMintCap + } + if err = k.setMinterSupply(ctx, minter, supply); err != nil { + return nil, err + } + // mint & transfer + c := sdk.NewCoin(precisebanktypes.ExtendedCoinDenom, sdk.NewIntFromBigInt(amount)) + if err = k.pbkeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(c)); err != nil { + return nil, err + } + recipient := sdk.AccAddress(common.BytesToAddress(msg.To).Bytes()) + if err = k.pbkeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, recipient, sdk.NewCoins(c)); err != nil { + return nil, err + } + return &types.MsgMintResponse{}, nil } // SetMinterCap implements types.MsgServer. func (k Keeper) SetMinterCap(goCtx context.Context, msg *types.MsgSetMintCap) (*types.MsgSetMintCapResponse, error) { - panic("unimplemented") + ctx := sdk.UnwrapSDKContext(goCtx) + minter := common.BytesToAddress(msg.Minter) + // validate authority + if k.authority != msg.Authority { + return nil, errorsmod.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", k.authority, msg.Authority) + } + // update minter cap + if err := k.setMinterCap(ctx, minter, new(big.Int).SetBytes(msg.Cap)); err != nil { + return nil, err + } + return &types.MsgSetMintCapResponse{}, nil } // SetWA0GI implements types.MsgServer. func (k Keeper) SetWA0GI(goCtx context.Context, msg *types.MsgSetWA0GI) (*types.MsgSetWA0GIResponse, error) { - panic("unimplemented") + ctx := sdk.UnwrapSDKContext(goCtx) + // validate authority + if k.authority != msg.Authority { + return nil, errorsmod.Wrapf(gov.ErrInvalidSigner, "expected %s got %s", k.authority, msg.Authority) + } + // save new address + k.SetWA0GIAddress(ctx, common.BytesToAddress(msg.Address)) + return &types.MsgSetWA0GIResponse{}, nil } diff --git a/x/wrapped-a0gi-base/types/errors.go b/x/wrapped-a0gi-base/types/errors.go index f77409c1..7b38b98c 100644 --- a/x/wrapped-a0gi-base/types/errors.go +++ b/x/wrapped-a0gi-base/types/errors.go @@ -3,5 +3,6 @@ package types import errorsmod "cosmossdk.io/errors" var ( - ErrTxForbidden = errorsmod.Register(ModuleName, 1, "cosmos tx forbidden") + ErrTxForbidden = errorsmod.Register(ModuleName, 1, "cosmos tx forbidden") + ErrInsufficientMintCap = errorsmod.Register(ModuleName, 2, "insufficient mint cap") ) diff --git a/x/wrapped-a0gi-base/types/genesis.go b/x/wrapped-a0gi-base/types/genesis.go index 75265bac..0b622117 100644 --- a/x/wrapped-a0gi-base/types/genesis.go +++ b/x/wrapped-a0gi-base/types/genesis.go @@ -1,18 +1,24 @@ package types +import "github.com/ethereum/go-ethereum/common" + +const ( + DEFAULT_WRAPPED_A0GI = "0000000000000000000000000000000000000000" +) + // NewGenesisState returns a new genesis state object for the module. -func NewGenesisState(addr string) *GenesisState { +func NewGenesisState(addr common.Address) *GenesisState { return &GenesisState{ - WrappedA0GiAddress: addr, + WrappedA0GiAddress: addr.Bytes(), } } // DefaultGenesisState returns the default genesis state for the module. func DefaultGenesisState() *GenesisState { - return NewGenesisState("0000000000000000000000000000000000000000") + return NewGenesisState(common.HexToAddress(DEFAULT_WRAPPED_A0GI)) } // Validate performs basic validation of genesis data. func (gs GenesisState) Validate() error { - return ValidateHexAddress(gs.WrappedA0GiAddress) + return nil } diff --git a/x/wrapped-a0gi-base/types/genesis.pb.go b/x/wrapped-a0gi-base/types/genesis.pb.go index dd6a07da..4d23ee39 100644 --- a/x/wrapped-a0gi-base/types/genesis.pb.go +++ b/x/wrapped-a0gi-base/types/genesis.pb.go @@ -29,7 +29,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the wrapped a0gi base module's genesis state. type GenesisState struct { // address of wrapped a0gi contract - WrappedA0GiAddress string `protobuf:"bytes,1,opt,name=wrapped_a0gi_address,json=wrappedA0giAddress,proto3" json:"wrapped_a0gi_address,omitempty"` + WrappedA0GiAddress []byte `protobuf:"bytes,1,opt,name=wrapped_a0gi_address,json=wrappedA0giAddress,proto3" json:"wrapped_a0gi_address,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -65,11 +65,11 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetWrappedA0GiAddress() string { +func (m *GenesisState) GetWrappedA0GiAddress() []byte { if m != nil { return m.WrappedA0GiAddress } - return "" + return nil } func init() { @@ -81,21 +81,21 @@ func init() { proto.RegisterFile("zgc/wrappeda0gibase/genesis.proto", fileDescri var fileDescriptor_7e056019f61fd820 = []byte{ // 246 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xbd, 0x4e, 0xc3, 0x30, - 0x10, 0x80, 0xe3, 0x05, 0x89, 0x88, 0x29, 0x74, 0xa0, 0x1d, 0xcc, 0xcf, 0xc4, 0x92, 0xd8, 0x12, - 0x3c, 0x00, 0x65, 0x61, 0x63, 0x80, 0x8d, 0x25, 0xb2, 0x1d, 0x73, 0xb5, 0xd4, 0xe4, 0xac, 0x9c, - 0x2b, 0x68, 0x9f, 0x82, 0xc7, 0x62, 0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, 0x9c, 0x7a, 0x9e, + 0xfc, 0xf4, 0x3c, 0x79, 0xbb, 0x07, 0x17, 0xb6, 0x7b, 0x5d, 0x18, 0xac, 0x85, 0x84, 0x9d, 0xd2, + 0x24, 0x24, 0xe4, 0x66, 0xab, 0x5c, 0x23, 0x3e, 0xff, 0x2f, 0x93, 0x0f, 0xdf, 0xe4, 0xe3, 0x6d, + 0xc2, 0xc1, 0x5b, 0xd2, 0x67, 0x63, 0xd8, 0xdd, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xec, 0x50, + 0x04, 0x4c, 0x3f, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -191,7 +191,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field WrappedA0GiAddress", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -201,23 +201,25 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthGenesis } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthGenesis } if postIndex > l { return io.ErrUnexpectedEOF } - m.WrappedA0GiAddress = string(dAtA[iNdEx:postIndex]) + m.WrappedA0GiAddress = append(m.WrappedA0GiAddress[:0], dAtA[iNdEx:postIndex]...) + if m.WrappedA0GiAddress == nil { + m.WrappedA0GiAddress = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/wrapped-a0gi-base/types/keys.go b/x/wrapped-a0gi-base/types/keys.go index 29578c19..47d86e2f 100644 --- a/x/wrapped-a0gi-base/types/keys.go +++ b/x/wrapped-a0gi-base/types/keys.go @@ -1,5 +1,7 @@ package types +import "encoding/hex" + const ( // ModuleName The name that will be used throughout the module ModuleName = "wrapped-a0gi-base" @@ -10,3 +12,16 @@ const ( // QuerierRoute Top level query string QuerierRoute = ModuleName ) + +var ( + // prefix + MinterCapKeyPrefix = []byte{0x00} + MinterSupplyKeyPrefix = []byte{0x01} + + // keys + WA0GIKey = []byte{0x00} +) + +func GetMinterKeyFromAccount(account string) ([]byte, error) { + return hex.DecodeString(account) +} diff --git a/x/wrapped-a0gi-base/types/msg.go b/x/wrapped-a0gi-base/types/msg.go index cc634912..6d6b4a00 100644 --- a/x/wrapped-a0gi-base/types/msg.go +++ b/x/wrapped-a0gi-base/types/msg.go @@ -1,26 +1,12 @@ package types import ( - "encoding/hex" - fmt "fmt" - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" ) var _, _, _, _ sdk.Msg = &MsgSetWA0GI{}, &MsgSetMintCap{}, &MsgMint{}, &MsgBurn{} -func ValidateHexAddress(account string) error { - addr, err := hex.DecodeString(account) - if err != nil { - return err - } - if len(addr) != 20 { - return fmt.Errorf("invalid address length") - } - return nil -} - func (msg *MsgSetWA0GI) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Authority) return []sdk.AccAddress{addr} @@ -31,10 +17,6 @@ func (msg *MsgSetWA0GI) ValidateBasic() error { return errorsmod.Wrap(err, "authority") } - if err := ValidateHexAddress(msg.Address); err != nil { - return errorsmod.Wrap(err, "address") - } - return nil } @@ -52,10 +34,6 @@ func (msg *MsgSetMintCap) ValidateBasic() error { return errorsmod.Wrap(err, "authority") } - if err := ValidateHexAddress(msg.Minter); err != nil { - return errorsmod.Wrap(err, "minter") - } - return nil } diff --git a/x/wrapped-a0gi-base/types/query.pb.go b/x/wrapped-a0gi-base/types/query.pb.go index bcba92eb..ed2753b2 100644 --- a/x/wrapped-a0gi-base/types/query.pb.go +++ b/x/wrapped-a0gi-base/types/query.pb.go @@ -32,15 +32,88 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type GetWA0GIRequest struct { +} + +func (m *GetWA0GIRequest) Reset() { *m = GetWA0GIRequest{} } +func (m *GetWA0GIRequest) String() string { return proto.CompactTextString(m) } +func (*GetWA0GIRequest) ProtoMessage() {} +func (*GetWA0GIRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_19911faa2ec12c75, []int{0} +} +func (m *GetWA0GIRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetWA0GIRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetWA0GIRequest.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 *GetWA0GIRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetWA0GIRequest.Merge(m, src) +} +func (m *GetWA0GIRequest) XXX_Size() int { + return m.Size() +} +func (m *GetWA0GIRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetWA0GIRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetWA0GIRequest proto.InternalMessageInfo + +type GetWA0GIResponse struct { + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *GetWA0GIResponse) Reset() { *m = GetWA0GIResponse{} } +func (m *GetWA0GIResponse) String() string { return proto.CompactTextString(m) } +func (*GetWA0GIResponse) ProtoMessage() {} +func (*GetWA0GIResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_19911faa2ec12c75, []int{1} +} +func (m *GetWA0GIResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetWA0GIResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetWA0GIResponse.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 *GetWA0GIResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetWA0GIResponse.Merge(m, src) +} +func (m *GetWA0GIResponse) XXX_Size() int { + return m.Size() +} +func (m *GetWA0GIResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetWA0GIResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetWA0GIResponse proto.InternalMessageInfo + type MinterSupplyRequest struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` } func (m *MinterSupplyRequest) Reset() { *m = MinterSupplyRequest{} } func (m *MinterSupplyRequest) String() string { return proto.CompactTextString(m) } func (*MinterSupplyRequest) ProtoMessage() {} func (*MinterSupplyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_19911faa2ec12c75, []int{0} + return fileDescriptor_19911faa2ec12c75, []int{2} } func (m *MinterSupplyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -70,15 +143,15 @@ func (m *MinterSupplyRequest) XXX_DiscardUnknown() { var xxx_messageInfo_MinterSupplyRequest proto.InternalMessageInfo type MinterSupplyResponse struct { - Cap string `protobuf:"bytes,1,opt,name=cap,proto3" json:"cap,omitempty"` - Supply string `protobuf:"bytes,2,opt,name=supply,proto3" json:"supply,omitempty"` + Cap []byte `protobuf:"bytes,1,opt,name=cap,proto3" json:"cap,omitempty"` + Supply []byte `protobuf:"bytes,2,opt,name=supply,proto3" json:"supply,omitempty"` } func (m *MinterSupplyResponse) Reset() { *m = MinterSupplyResponse{} } func (m *MinterSupplyResponse) String() string { return proto.CompactTextString(m) } func (*MinterSupplyResponse) ProtoMessage() {} func (*MinterSupplyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_19911faa2ec12c75, []int{1} + return fileDescriptor_19911faa2ec12c75, []int{3} } func (m *MinterSupplyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -108,6 +181,8 @@ func (m *MinterSupplyResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MinterSupplyResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*GetWA0GIRequest)(nil), "zgc.wrappeda0gibase.GetWA0GIRequest") + proto.RegisterType((*GetWA0GIResponse)(nil), "zgc.wrappeda0gibase.GetWA0GIResponse") proto.RegisterType((*MinterSupplyRequest)(nil), "zgc.wrappeda0gibase.MinterSupplyRequest") proto.RegisterType((*MinterSupplyResponse)(nil), "zgc.wrappeda0gibase.MinterSupplyResponse") } @@ -115,29 +190,33 @@ func init() { func init() { proto.RegisterFile("zgc/wrappeda0gibase/query.proto", fileDescriptor_19911faa2ec12c75) } var fileDescriptor_19911faa2ec12c75 = []byte{ - // 348 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xc1, 0x4a, 0x2b, 0x31, - 0x14, 0x86, 0x27, 0xbd, 0xdc, 0x5e, 0x6e, 0x70, 0x21, 0x69, 0x91, 0x76, 0x90, 0x54, 0x2a, 0x42, - 0x45, 0x66, 0x32, 0xa8, 0x0f, 0x20, 0xee, 0x5d, 0x58, 0x77, 0x6e, 0x24, 0x33, 0x8d, 0x69, 0xa0, - 0x93, 0xa4, 0x93, 0x0c, 0xda, 0x2e, 0x7d, 0x82, 0x82, 0x3b, 0x9f, 0xa8, 0xcb, 0x82, 0x1b, 0x97, - 0xda, 0xfa, 0x20, 0x32, 0x99, 0x29, 0x68, 0xe9, 0xc2, 0x5d, 0xfe, 0x73, 0xbe, 0xff, 0xe4, 0xf0, - 0x1f, 0xd8, 0x99, 0xf2, 0x84, 0x3c, 0x64, 0x54, 0x6b, 0x36, 0xa0, 0x11, 0x17, 0x31, 0x35, 0x8c, - 0x8c, 0x73, 0x96, 0x4d, 0x42, 0x9d, 0x29, 0xab, 0x50, 0x63, 0xca, 0x93, 0x70, 0x03, 0xf0, 0xdb, - 0x89, 0x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0x56, 0xd8, 0x7b, 0x5b, 0x61, 0xef, 0xf6, - 0x9c, 0x0b, 0x3b, 0xcc, 0xe3, 0x30, 0x51, 0x29, 0x89, 0xf8, 0x88, 0xc6, 0x86, 0x44, 0x3c, 0x48, - 0x86, 0x54, 0x48, 0xf2, 0xb8, 0x65, 0xb6, 0x9d, 0x68, 0x66, 0xe2, 0xba, 0x8b, 0xfa, 0xec, 0x2b, - 0x00, 0x00, 0xff, 0xff, 0x26, 0x34, 0x94, 0xac, 0x2d, 0x02, 0x00, 0x00, + // 410 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6e, 0xd3, 0x30, + 0x18, 0xc7, 0x93, 0x22, 0x0a, 0xb2, 0x2a, 0x51, 0xdc, 0x0a, 0xb5, 0x11, 0x4a, 0x21, 0x50, 0x51, + 0x04, 0x89, 0x23, 0xe0, 0x01, 0x80, 0x4b, 0xc5, 0x81, 0x03, 0xe5, 0x80, 0xc4, 0x05, 0x39, 0xa9, + 0x71, 0x23, 0x35, 0xb1, 0x1b, 0x3b, 0xea, 0xda, 0xd3, 0xb4, 0x27, 0xa8, 0xb4, 0xf3, 0xde, 0xa7, + 0xc7, 0x4a, 0xbb, 0xec, 0xb8, 0xb5, 0x7b, 0x90, 0x29, 0x8e, 0xa3, 0x6d, 0x55, 0xb4, 0xed, 0xe6, + 0xff, 0xe7, 0xdf, 0xe7, 0xef, 0xef, 0xbf, 0x0d, 0x7a, 0x4b, 0x1a, 0xa2, 0x79, 0x8a, 0x39, 0x27, + 0x63, 0xec, 0xd3, 0x28, 0xc0, 0x82, 0xa0, 0x59, 0x46, 0xd2, 0x85, 0xc7, 0x53, 0x26, 0x19, 0x6c, + 0x2d, 0x69, 0xe8, 0xed, 0x01, 0x56, 0x37, 0x64, 0x22, 0x66, 0xe2, 0x9f, 0x42, 0x50, 0x21, 0x0a, + 0xde, 0x6a, 0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, 0x1c, 0x54, 0x0e, 0xa8, 0xc8, 0xc8, + 0x7a, 0xff, 0x00, 0x52, 0xdb, 0xf9, 0xa0, 0xec, 0xf4, 0xe1, 0x9b, 0x6a, 0x3b, 0xb1, 0xea, 0x71, + 0x8b, 0x7c, 0xbe, 0x8f, 0xd6, 0x17, 0xb6, 0xb1, 0xde, 0xda, 0xe6, 0x66, 0x6b, 0x9b, 0xe7, 0x5b, + 0xdb, 0x5c, 0xed, 0x6c, 0x63, 0xb3, 0xb3, 0x8d, 0xb3, 0x9d, 0x6d, 0xfc, 0xfd, 0x42, 0x23, 0x39, + 0xc9, 0x02, 0x2f, 0x64, 0x31, 0xf2, 0xe9, 0x14, 0x07, 0x02, 0xf9, 0xd4, 0x0d, 0x27, 0x38, 0x4a, + 0xd0, 0x41, 0xc5, 0xd9, 0x72, 0xc1, 0x89, 0x08, 0xea, 0xea, 0xbb, 0x7c, 0xbe, 0x0a, 0x00, 0x00, + 0xff, 0xff, 0x14, 0xfb, 0x91, 0x88, 0xf1, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -152,6 +231,7 @@ 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 { + GetWA0GI(ctx context.Context, in *GetWA0GIRequest, opts ...grpc.CallOption) (*GetWA0GIResponse, error) MinterSupply(ctx context.Context, in *MinterSupplyRequest, opts ...grpc.CallOption) (*MinterSupplyResponse, error) } @@ -163,6 +243,15 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } +func (c *queryClient) GetWA0GI(ctx context.Context, in *GetWA0GIRequest, opts ...grpc.CallOption) (*GetWA0GIResponse, error) { + out := new(GetWA0GIResponse) + err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.Query/GetWA0GI", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) MinterSupply(ctx context.Context, in *MinterSupplyRequest, opts ...grpc.CallOption) (*MinterSupplyResponse, error) { out := new(MinterSupplyResponse) err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.Query/MinterSupply", in, out, opts...) @@ -174,6 +263,7 @@ func (c *queryClient) MinterSupply(ctx context.Context, in *MinterSupplyRequest, // QueryServer is the server API for Query service. type QueryServer interface { + GetWA0GI(context.Context, *GetWA0GIRequest) (*GetWA0GIResponse, error) MinterSupply(context.Context, *MinterSupplyRequest) (*MinterSupplyResponse, error) } @@ -181,6 +271,9 @@ type QueryServer interface { type UnimplementedQueryServer struct { } +func (*UnimplementedQueryServer) GetWA0GI(ctx context.Context, req *GetWA0GIRequest) (*GetWA0GIResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetWA0GI not implemented") +} func (*UnimplementedQueryServer) MinterSupply(ctx context.Context, req *MinterSupplyRequest) (*MinterSupplyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MinterSupply not implemented") } @@ -189,6 +282,24 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } +func _Query_GetWA0GI_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetWA0GIRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetWA0GI(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zgc.wrappeda0gibase.Query/GetWA0GI", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetWA0GI(ctx, req.(*GetWA0GIRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_MinterSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MinterSupplyRequest) if err := dec(in); err != nil { @@ -211,6 +322,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "zgc.wrappeda0gibase.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "GetWA0GI", + Handler: _Query_GetWA0GI_Handler, + }, { MethodName: "MinterSupply", Handler: _Query_MinterSupply_Handler, @@ -220,6 +335,59 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "zgc/wrappeda0gibase/query.proto", } +func (m *GetWA0GIRequest) 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 *GetWA0GIRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetWA0GIRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *GetWA0GIResponse) 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 *GetWA0GIResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetWA0GIResponse) 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] = 0xa + } + return len(dAtA) - i, nil +} + func (m *MinterSupplyRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -298,6 +466,28 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *GetWA0GIRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *GetWA0GIResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *MinterSupplyRequest) Size() (n int) { if m == nil { return 0 @@ -334,6 +524,140 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *GetWA0GIRequest) 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: GetWA0GIRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetWA0GIRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetWA0GIResponse) 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: GetWA0GIResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetWA0GIResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} + } + 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 *MinterSupplyRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -367,7 +691,7 @@ func (m *MinterSupplyRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -377,23 +701,25 @@ func (m *MinterSupplyRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex @@ -449,7 +775,7 @@ func (m *MinterSupplyResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Cap", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -459,29 +785,31 @@ func (m *MinterSupplyResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Cap = string(dAtA[iNdEx:postIndex]) + m.Cap = append(m.Cap[:0], dAtA[iNdEx:postIndex]...) + if m.Cap == nil { + m.Cap = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Supply", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -491,23 +819,25 @@ func (m *MinterSupplyResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Supply = string(dAtA[iNdEx:postIndex]) + m.Supply = append(m.Supply[:0], dAtA[iNdEx:postIndex]...) + if m.Supply == nil { + m.Supply = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/wrapped-a0gi-base/types/query.pb.gw.go b/x/wrapped-a0gi-base/types/query.pb.gw.go index a4bbda75..17f15012 100644 --- a/x/wrapped-a0gi-base/types/query.pb.gw.go +++ b/x/wrapped-a0gi-base/types/query.pb.gw.go @@ -33,6 +33,24 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join +func request_Query_GetWA0GI_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetWA0GIRequest + var metadata runtime.ServerMetadata + + msg, err := client.GetWA0GI(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetWA0GI_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetWA0GIRequest + var metadata runtime.ServerMetadata + + msg, err := server.GetWA0GI(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_Query_MinterSupply_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -75,6 +93,29 @@ func local_request_Query_MinterSupply_0(ctx context.Context, marshaler runtime.M // 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_GetWA0GI_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_GetWA0GI_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_GetWA0GI_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_MinterSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -139,6 +180,26 @@ 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_GetWA0GI_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_GetWA0GI_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_GetWA0GI_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_MinterSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -163,9 +224,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( + pattern_Query_GetWA0GI_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"0g", "wrapped-a0gi-base", "get-wa0gi"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_MinterSupply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"0g", "wrapped-a0gi-base", "minter-supply"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( + forward_Query_GetWA0GI_0 = runtime.ForwardResponseMessage + forward_Query_MinterSupply_0 = runtime.ForwardResponseMessage ) diff --git a/x/wrapped-a0gi-base/types/tx.pb.go b/x/wrapped-a0gi-base/types/tx.pb.go index 78de5739..1760ab6d 100644 --- a/x/wrapped-a0gi-base/types/tx.pb.go +++ b/x/wrapped-a0gi-base/types/tx.pb.go @@ -32,7 +32,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgSetWA0GI struct { Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + Address []byte `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` } func (m *MsgSetWA0GI) Reset() { *m = MsgSetWA0GI{} } @@ -106,8 +106,8 @@ var xxx_messageInfo_MsgSetWA0GIResponse proto.InternalMessageInfo type MsgSetMintCap struct { Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - Minter string `protobuf:"bytes,2,opt,name=minter,proto3" json:"minter,omitempty"` - Cap string `protobuf:"bytes,3,opt,name=cap,proto3" json:"cap,omitempty"` + Minter []byte `protobuf:"bytes,2,opt,name=minter,proto3" json:"minter,omitempty"` + Cap []byte `protobuf:"bytes,3,opt,name=cap,proto3" json:"cap,omitempty"` } func (m *MsgSetMintCap) Reset() { *m = MsgSetMintCap{} } @@ -180,9 +180,9 @@ func (m *MsgSetMintCapResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetMintCapResponse proto.InternalMessageInfo type MsgMint struct { - Minter string `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter,omitempty"` - To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` - Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` + Minter []byte `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter,omitempty"` + To []byte `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` + Amount []byte `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` } func (m *MsgMint) Reset() { *m = MsgMint{} } @@ -255,8 +255,8 @@ func (m *MsgMintResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgMintResponse proto.InternalMessageInfo type MsgBurn struct { - Minter string `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter,omitempty"` - Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + Minter []byte `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter,omitempty"` + Amount []byte `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` } func (m *MsgBurn) Reset() { *m = MsgBurn{} } @@ -342,35 +342,35 @@ func init() { func init() { proto.RegisterFile("zgc/wrappeda0gibase/tx.proto", fileDescriptor_f80bf93a1fc022d3) } var fileDescriptor_f80bf93a1fc022d3 = []byte{ - // 433 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcf, 0x6b, 0xd4, 0x40, - 0x14, 0xc7, 0x93, 0xac, 0xb4, 0xf6, 0xf9, 0x3b, 0xb5, 0x9a, 0x86, 0x25, 0x94, 0xe0, 0xa1, 0x08, - 0x9b, 0x09, 0xea, 0xc5, 0xa3, 0x15, 0x91, 0x0a, 0xb9, 0xac, 0x60, 0xc1, 0x83, 0x32, 0xc9, 0x8e, - 0xb3, 0x81, 0x26, 0x13, 0x32, 0x13, 0xec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c, 0xfe, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xd8, 0x1c, 0xf0, 0xaf, 0x03, 0x00, - 0x00, + // 436 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcf, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x93, 0x54, 0x76, 0xdd, 0xe7, 0xfa, 0x2b, 0xeb, 0x6a, 0x36, 0x94, 0x50, 0x82, 0x87, + 0x22, 0x34, 0x13, 0xd4, 0x8b, 0x47, 0x57, 0x44, 0x56, 0xc8, 0x25, 0x82, 0x0b, 0x1e, 0x94, 0x49, + 0x3a, 0x4e, 0x03, 0x9b, 0x4c, 0xc8, 0x4c, 0x70, 0xbb, 0x7f, 0x85, 0x7f, 0xd6, 0x1e, 0x7b, 0x11, + 0x3c, 0x6a, 0xfb, 0x8f, 0xc8, 0x24, 0x93, 0x34, 0x95, 0xa6, 0xbd, 0xcd, 0xfb, 0xbe, 0xef, 0xfb, + 0x3c, 0xf8, 0x0e, 0x0f, 0x86, 0x37, 0x34, 0x46, 0x3f, 0x0a, 0x9c, 0xe7, 0x64, 0x8a, 0x7d, 0x9a, + 0x44, 0x98, 0x13, 0x24, 0xae, 0xbd, 0xbc, 0x60, 0x82, 0x99, 0x27, 0x37, 0x34, 0xf6, 0xfe, 0xeb, + 0xda, 0x67, 0x31, 0xe3, 0x29, 0xe3, 0xdf, 0x2a, 0x0b, 0xaa, 0x8b, 0xda, 0x6f, 0x3f, 0xa1, 0x8c, + 0xb2, 0x5a, 0x97, 0x2f, 0xa5, 0x9e, 0x51, 0xc6, 0xe8, 0x15, 0x41, 0x55, 0x15, 0x95, 0xdf, 0x11, + 0xce, 0xe6, 0x75, 0xcb, 0x7d, 0x0f, 0xf7, 0x02, 0x4e, 0x3f, 0x11, 0x71, 0xf9, 0xd6, 0xff, 0x70, + 0x61, 0x0e, 0xe1, 0x08, 0x97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x77, 0x75, 0xbb, 0xac, 0x2a, 0xd6, 0x5e, + 0x96, 0xec, 0xf6, 0xb3, 0xba, 0xb9, 0x9e, 0x87, 0xb7, 0x7f, 0x1d, 0xed, 0x76, 0xe9, 0xe8, 0x8b, + 0xa5, 0xa3, 0xff, 0x59, 0x3a, 0xfa, 0xcf, 0x95, 0xa3, 0x2d, 0x56, 0x8e, 0xf6, 0x7b, 0xe5, 0x68, + 0x5f, 0x5e, 0xd3, 0x44, 0xcc, 0xca, 0xc8, 0x8b, 0x59, 0x8a, 0x7c, 0x7a, 0x85, 0x23, 0x8e, 0x7c, + 0x3a, 0x89, 0x67, 0x38, 0xc9, 0xd0, 0x75, 0x73, 0x89, 0x13, 0x09, 0x9f, 0xd4, 0xb7, 0x38, 0xcf, + 0x09, 0x8f, 0x0e, 0xaa, 0x73, 0x79, 0xf5, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x19, 0x0a, 0x77, + 0xaf, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1009,7 +1009,7 @@ func (m *MsgSetWA0GI) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1019,23 +1019,25 @@ func (m *MsgSetWA0GI) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex @@ -1173,7 +1175,7 @@ func (m *MsgSetMintCap) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Minter", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1183,29 +1185,31 @@ func (m *MsgSetMintCap) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Minter = string(dAtA[iNdEx:postIndex]) + m.Minter = append(m.Minter[:0], dAtA[iNdEx:postIndex]...) + if m.Minter == nil { + m.Minter = []byte{} + } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Cap", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1215,23 +1219,25 @@ func (m *MsgSetMintCap) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Cap = string(dAtA[iNdEx:postIndex]) + m.Cap = append(m.Cap[:0], dAtA[iNdEx:postIndex]...) + if m.Cap == nil { + m.Cap = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex @@ -1337,7 +1343,7 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Minter", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1347,29 +1353,31 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Minter = string(dAtA[iNdEx:postIndex]) + m.Minter = append(m.Minter[:0], dAtA[iNdEx:postIndex]...) + if m.Minter == nil { + m.Minter = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1379,29 +1387,31 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.To = string(dAtA[iNdEx:postIndex]) + m.To = append(m.To[:0], dAtA[iNdEx:postIndex]...) + if m.To == nil { + m.To = []byte{} + } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1411,23 +1421,25 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = string(dAtA[iNdEx:postIndex]) + m.Amount = append(m.Amount[:0], dAtA[iNdEx:postIndex]...) + if m.Amount == nil { + m.Amount = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex @@ -1533,7 +1545,7 @@ func (m *MsgBurn) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Minter", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1543,29 +1555,31 @@ func (m *MsgBurn) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Minter = string(dAtA[iNdEx:postIndex]) + m.Minter = append(m.Minter[:0], dAtA[iNdEx:postIndex]...) + if m.Minter == nil { + m.Minter = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1575,23 +1589,25 @@ func (m *MsgBurn) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = string(dAtA[iNdEx:postIndex]) + m.Amount = append(m.Amount[:0], dAtA[iNdEx:postIndex]...) + if m.Amount == nil { + m.Amount = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex