From ac043ff438140fea68650c373bf19e1aea26e2f5 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:36:02 +0800 Subject: [PATCH] feat: refactor wrapped a0gi base --- .../interfaces/contracts/IWrappedA0GIBase.sol | 8 +- .../wrapped-a0gi-base/IWrappedA0GIBase.json | 7 +- precompiles/wrapped-a0gi-base/contract.go | 8 +- precompiles/wrapped-a0gi-base/query.go | 5 +- precompiles/wrapped-a0gi-base/query_test.go | 17 +- precompiles/wrapped-a0gi-base/tx_test.go | 31 +- precompiles/wrapped-a0gi-base/types.go | 5 +- .../wrappeda0gibase/{ => v1}/genesis.proto | 2 +- .../zgc/wrappeda0gibase/{ => v1}/query.proto | 6 +- proto/zgc/wrappeda0gibase/{ => v1}/tx.proto | 3 +- .../wrappeda0gibase/v1/wrappeda0gibase.proto | 17 + x/wrapped-a0gi-base/keeper/grpc_query.go | 7 +- x/wrapped-a0gi-base/keeper/keeper.go | 32 +- x/wrapped-a0gi-base/keeper/msg_server.go | 55 ++- x/wrapped-a0gi-base/keeper/msg_server_test.go | 107 +++-- x/wrapped-a0gi-base/types/genesis.pb.go | 46 +- x/wrapped-a0gi-base/types/keys.go | 1 - x/wrapped-a0gi-base/types/query.pb.go | 170 +++---- x/wrapped-a0gi-base/types/query.pb.gw.go | 2 +- x/wrapped-a0gi-base/types/tx.pb.go | 168 ++++--- .../types/wrappeda0gibase.pb.go | 416 ++++++++++++++++++ 21 files changed, 809 insertions(+), 304 deletions(-) rename proto/zgc/wrappeda0gibase/{ => v1}/genesis.proto (92%) rename proto/zgc/wrappeda0gibase/{ => v1}/query.proto (89%) rename proto/zgc/wrappeda0gibase/{ => v1}/tx.proto (93%) create mode 100644 proto/zgc/wrappeda0gibase/v1/wrappeda0gibase.proto create mode 100644 x/wrapped-a0gi-base/types/wrappeda0gibase.pb.go diff --git a/precompiles/interfaces/contracts/IWrappedA0GIBase.sol b/precompiles/interfaces/contracts/IWrappedA0GIBase.sol index ad7e8132..614208a8 100644 --- a/precompiles/interfaces/contracts/IWrappedA0GIBase.sol +++ b/precompiles/interfaces/contracts/IWrappedA0GIBase.sol @@ -3,7 +3,8 @@ pragma solidity >=0.8.0; struct Supply { uint256 cap; - uint256 total; + uint256 initialSupply; + uint256 supply; } /** @@ -23,12 +24,13 @@ interface IWrappedA0GIBase { function getWA0GI() external view returns (address); /** - * @dev set the cap for a minter. + * @dev set the cap and initial supply for a minter. * It is designed to be called by governance module only so it's not implemented at EVM precompile side. * @param minter minter address * @param cap mint cap + * @param initialSupply initial mint supply */ - // function setMinterCap(address minter, uint256 cap) external; + // function setMinterCap(address minter, uint256 cap, uint256 initialSupply) external; /** * @dev get the mint supply of given address diff --git a/precompiles/wrapped-a0gi-base/IWrappedA0GIBase.json b/precompiles/wrapped-a0gi-base/IWrappedA0GIBase.json index 67a7800b..064863b1 100644 --- a/precompiles/wrapped-a0gi-base/IWrappedA0GIBase.json +++ b/precompiles/wrapped-a0gi-base/IWrappedA0GIBase.json @@ -67,7 +67,12 @@ }, { "internalType": "uint256", - "name": "total", + "name": "initialSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", "type": "uint256" } ], diff --git a/precompiles/wrapped-a0gi-base/contract.go b/precompiles/wrapped-a0gi-base/contract.go index 3cadb588..8e3b68f7 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\":[],\"name\":\"getWA0GI\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"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\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"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\":\"initialSupply\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supply\",\"type\":\"uint256\"}],\"internalType\":\"structSupply\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // Wrappeda0gibaseABI is the input ABI used to generate the binding from. @@ -212,7 +212,7 @@ func (_Wrappeda0gibase *Wrappeda0gibaseCallerSession) GetWA0GI() (common.Address // MinterSupply is a free data retrieval call binding the contract method 0x95609212. // -// Solidity: function minterSupply(address minter) view returns((uint256,uint256)) +// Solidity: function minterSupply(address minter) view returns((uint256,uint256,uint256)) func (_Wrappeda0gibase *Wrappeda0gibaseCaller) MinterSupply(opts *bind.CallOpts, minter common.Address) (Supply, error) { var out []interface{} err := _Wrappeda0gibase.contract.Call(opts, &out, "minterSupply", minter) @@ -229,14 +229,14 @@ func (_Wrappeda0gibase *Wrappeda0gibaseCaller) MinterSupply(opts *bind.CallOpts, // MinterSupply is a free data retrieval call binding the contract method 0x95609212. // -// Solidity: function minterSupply(address minter) view returns((uint256,uint256)) +// Solidity: function minterSupply(address minter) view returns((uint256,uint256,uint256)) func (_Wrappeda0gibase *Wrappeda0gibaseSession) MinterSupply(minter common.Address) (Supply, error) { return _Wrappeda0gibase.Contract.MinterSupply(&_Wrappeda0gibase.CallOpts, minter) } // MinterSupply is a free data retrieval call binding the contract method 0x95609212. // -// Solidity: function minterSupply(address minter) view returns((uint256,uint256)) +// Solidity: function minterSupply(address minter) view returns((uint256,uint256,uint256)) func (_Wrappeda0gibase *Wrappeda0gibaseCallerSession) MinterSupply(minter common.Address) (Supply, error) { return _Wrappeda0gibase.Contract.MinterSupply(&_Wrappeda0gibase.CallOpts, minter) } diff --git a/precompiles/wrapped-a0gi-base/query.go b/precompiles/wrapped-a0gi-base/query.go index 9052dbf7..af6b711a 100644 --- a/precompiles/wrapped-a0gi-base/query.go +++ b/precompiles/wrapped-a0gi-base/query.go @@ -31,8 +31,9 @@ func (w *WrappedA0giBasePrecompile) MinterSupply(ctx sdk.Context, _ *vm.EVM, met return nil, err } supply := Supply{ - Cap: new(big.Int).SetBytes(response.Cap), - Total: new(big.Int).SetBytes(response.Supply), + Cap: new(big.Int).SetBytes(response.Supply.Cap), + InitialSupply: new(big.Int).SetBytes(response.Supply.InitialSupply), + Supply: new(big.Int).SetBytes(response.Supply.Supply), } return method.Outputs.Pack(supply) } diff --git a/precompiles/wrapped-a0gi-base/query_test.go b/precompiles/wrapped-a0gi-base/query_test.go index e987c4b4..33aa9ed4 100644 --- a/precompiles/wrapped-a0gi-base/query_test.go +++ b/precompiles/wrapped-a0gi-base/query_test.go @@ -85,9 +85,10 @@ func (s *WrappedA0giBaseTestSuite) TestMinterSupply() { func(data []byte) { out, err := s.abi.Methods[method].Outputs.Unpack(data) s.Require().NoError(err, "failed to unpack output") - wa0gi := out[0].(wrappeda0gibaseprecompile.Supply) - s.Require().Equal(wa0gi.Cap, big.NewInt(8e18)) - s.Require().Equal(wa0gi.Total, big.NewInt(1e18)) + supply := out[0].(wrappeda0gibaseprecompile.Supply) + s.Require().Equal(supply.Cap, big.NewInt(8e18)) + s.Require().Equal(supply.InitialSupply, big.NewInt(4e18)) + s.Require().Equal(supply.Supply, big.NewInt(4e18+1e18)) // fmt.Println(wa0gi) }, 100000, @@ -108,7 +109,8 @@ func (s *WrappedA0giBaseTestSuite) TestMinterSupply() { s.Require().NoError(err, "failed to unpack output") supply := out[0].(wrappeda0gibaseprecompile.Supply) s.Require().Equal(supply.Cap.Bytes(), big.NewInt(0).Bytes()) - s.Require().Equal(supply.Total.Bytes(), big.NewInt(0).Bytes()) + s.Require().Equal(supply.InitialSupply.Bytes(), big.NewInt(0).Bytes()) + s.Require().Equal(supply.Supply.Bytes(), big.NewInt(0).Bytes()) // fmt.Println(wa0gi) }, 100000, @@ -122,9 +124,10 @@ func (s *WrappedA0giBaseTestSuite) TestMinterSupply() { s.SetupTest() s.wa0gibasekeeper.SetMinterCap(sdk.WrapSDKContext(s.Ctx), &types.MsgSetMinterCap{ - Authority: govAccAddr, - Minter: s.signerOne.Addr.Bytes(), - Cap: big.NewInt(8e18).Bytes(), + Authority: govAccAddr, + Minter: s.signerOne.Addr.Bytes(), + Cap: big.NewInt(8e18).Bytes(), + InitialSupply: big.NewInt(4e18).Bytes(), }) s.wa0gibasekeeper.Mint(sdk.WrapSDKContext(s.Ctx), &types.MsgMint{ diff --git a/precompiles/wrapped-a0gi-base/tx_test.go b/precompiles/wrapped-a0gi-base/tx_test.go index acf3e262..5568be3a 100644 --- a/precompiles/wrapped-a0gi-base/tx_test.go +++ b/precompiles/wrapped-a0gi-base/tx_test.go @@ -1,7 +1,6 @@ package wrappeda0gibase_test import ( - "fmt" "math/big" wrappeda0gibaseprecompile "github.com/0glabs/0g-chain/precompiles/wrapped-a0gi-base" @@ -38,8 +37,9 @@ func (s *WrappedA0giBaseTestSuite) TestMint() { Address: s.signerOne.Addr.Bytes(), }) s.Assert().NoError(err) - s.Require().Equal(supply.Cap, big.NewInt(8e18).Bytes()) - s.Require().Equal(supply.Supply, big.NewInt(1e18).Bytes()) + s.Require().Equal(supply.Supply.Cap, big.NewInt(8e18).Bytes()) + s.Require().Equal(supply.Supply.InitialSupply, big.NewInt(4e18).Bytes()) + s.Require().Equal(supply.Supply.Supply, big.NewInt(4e18+1e18).Bytes()) // fmt.Println(wa0gi) }, 100000, @@ -85,12 +85,12 @@ func (s *WrappedA0giBaseTestSuite) TestMint() { s.Run(tc.name, func() { s.SetupTest() - fmt.Println(s.signerOne.Addr) s.wa0gibasekeeper.SetWA0GIAddress(s.Ctx, s.signerOne.Addr) s.wa0gibasekeeper.SetMinterCap(sdk.WrapSDKContext(s.Ctx), &types.MsgSetMinterCap{ - Authority: govAccAddr, - Minter: s.signerOne.Addr.Bytes(), - Cap: big.NewInt(8e18).Bytes(), + Authority: govAccAddr, + Minter: s.signerOne.Addr.Bytes(), + Cap: big.NewInt(8e18).Bytes(), + InitialSupply: big.NewInt(4e18).Bytes(), }) var err error @@ -140,8 +140,9 @@ func (s *WrappedA0giBaseTestSuite) TestBurn() { Address: s.signerOne.Addr.Bytes(), }) s.Assert().NoError(err) - s.Require().Equal(supply.Cap, big.NewInt(8e18).Bytes()) - s.Require().Equal(supply.Supply, big.NewInt(3e18).Bytes()) + s.Require().Equal(supply.Supply.Cap, big.NewInt(8e18).Bytes()) + s.Require().Equal(supply.Supply.InitialSupply, big.NewInt(4e18).Bytes()) + s.Require().Equal(supply.Supply.Supply, big.NewInt(3e18).Bytes()) // fmt.Println(wa0gi) }, 100000, @@ -187,16 +188,12 @@ func (s *WrappedA0giBaseTestSuite) TestBurn() { s.Run(tc.name, func() { s.SetupTest() - fmt.Println(s.signerOne.Addr) s.wa0gibasekeeper.SetWA0GIAddress(s.Ctx, s.signerOne.Addr) s.wa0gibasekeeper.SetMinterCap(sdk.WrapSDKContext(s.Ctx), &types.MsgSetMinterCap{ - Authority: govAccAddr, - Minter: s.signerOne.Addr.Bytes(), - Cap: big.NewInt(8e18).Bytes(), - }) - s.wa0gibasekeeper.Mint(sdk.WrapSDKContext(s.Ctx), &types.MsgMint{ - Minter: s.signerOne.Addr.Bytes(), - Amount: big.NewInt(4e18).Bytes(), + Authority: govAccAddr, + Minter: s.signerOne.Addr.Bytes(), + Cap: big.NewInt(8e18).Bytes(), + InitialSupply: big.NewInt(4e18).Bytes(), }) var err error diff --git a/precompiles/wrapped-a0gi-base/types.go b/precompiles/wrapped-a0gi-base/types.go index 23c6c2c0..5e1f4db7 100644 --- a/precompiles/wrapped-a0gi-base/types.go +++ b/precompiles/wrapped-a0gi-base/types.go @@ -10,8 +10,9 @@ import ( ) type Supply = struct { - Cap *big.Int "json:\"cap\"" - Total *big.Int "json:\"total\"" + Cap *big.Int "json:\"cap\"" + InitialSupply *big.Int "json:\"initialSupply\"" + Supply *big.Int "json:\"supply\"" } func NewGetW0GIRequest(args []interface{}) (*types.GetWA0GIRequest, error) { diff --git a/proto/zgc/wrappeda0gibase/genesis.proto b/proto/zgc/wrappeda0gibase/v1/genesis.proto similarity index 92% rename from proto/zgc/wrappeda0gibase/genesis.proto rename to proto/zgc/wrappeda0gibase/v1/genesis.proto index 3915a898..91dd73aa 100644 --- a/proto/zgc/wrappeda0gibase/genesis.proto +++ b/proto/zgc/wrappeda0gibase/v1/genesis.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package zgc.wrappeda0gibase; +package zgc.wrappeda0gibase.v1; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; diff --git a/proto/zgc/wrappeda0gibase/query.proto b/proto/zgc/wrappeda0gibase/v1/query.proto similarity index 89% rename from proto/zgc/wrappeda0gibase/query.proto rename to proto/zgc/wrappeda0gibase/v1/query.proto index a242ad39..447a0091 100644 --- a/proto/zgc/wrappeda0gibase/query.proto +++ b/proto/zgc/wrappeda0gibase/v1/query.proto @@ -1,11 +1,12 @@ syntax = "proto3"; -package zgc.wrappeda0gibase; +package zgc.wrappeda0gibase.v1; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; +import "zgc/wrappeda0gibase/v1/wrappeda0gibase.proto"; option go_package = "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"; option (gogoproto.goproto_getters_all) = false; @@ -31,6 +32,5 @@ message MinterSupplyRequest { } message MinterSupplyResponse { - bytes cap = 1; // big endian - bytes supply = 2; // big endian + Supply supply = 1; } diff --git a/proto/zgc/wrappeda0gibase/tx.proto b/proto/zgc/wrappeda0gibase/v1/tx.proto similarity index 93% rename from proto/zgc/wrappeda0gibase/tx.proto rename to proto/zgc/wrappeda0gibase/v1/tx.proto index 323dce06..7706a6d7 100644 --- a/proto/zgc/wrappeda0gibase/tx.proto +++ b/proto/zgc/wrappeda0gibase/v1/tx.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package zgc.wrappeda0gibase; +package zgc.wrappeda0gibase.v1; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -27,6 +27,7 @@ message MsgSetMinterCap { string authority = 1; bytes minter = 2; bytes cap = 3; // big endian + bytes initialSupply = 4; // big endian } message MsgSetMinterCapResponse {} diff --git a/proto/zgc/wrappeda0gibase/v1/wrappeda0gibase.proto b/proto/zgc/wrappeda0gibase/v1/wrappeda0gibase.proto new file mode 100644 index 00000000..9327fc64 --- /dev/null +++ b/proto/zgc/wrappeda0gibase/v1/wrappeda0gibase.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package zgc.wrappeda0gibase.v1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"; +option (gogoproto.goproto_getters_all) = false; + +message Supply { + bytes cap = 1; // big endian + bytes initialSupply = 2; // big endian + bytes supply = 3; // big endian +} diff --git a/x/wrapped-a0gi-base/keeper/grpc_query.go b/x/wrapped-a0gi-base/keeper/grpc_query.go index 3164fb26..d024c24c 100644 --- a/x/wrapped-a0gi-base/keeper/grpc_query.go +++ b/x/wrapped-a0gi-base/keeper/grpc_query.go @@ -14,17 +14,12 @@ var _ types.QueryServer = Keeper{} func (k Keeper) MinterSupply(c context.Context, request *types.MinterSupplyRequest) (*types.MinterSupplyResponse, error) { 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(), + Supply: &supply, }, nil } diff --git a/x/wrapped-a0gi-base/keeper/keeper.go b/x/wrapped-a0gi-base/keeper/keeper.go index 13a77c67..ba23b578 100644 --- a/x/wrapped-a0gi-base/keeper/keeper.go +++ b/x/wrapped-a0gi-base/keeper/keeper.go @@ -46,26 +46,24 @@ func (k Keeper) GetWA0GIAddress(ctx sdk.Context) []byte { 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()) +func (k Keeper) setMinterSupply(ctx sdk.Context, account common.Address, supply types.Supply) error { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.MinterSupplyKeyPrefix) + bz := k.cdc.MustMarshal(&supply) + store.Set(account.Bytes(), bz) 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) { +func (k Keeper) getMinterSupply(ctx sdk.Context, account common.Address) (types.Supply, error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.MinterSupplyKeyPrefix) bz := store.Get(account.Bytes()) - return new(big.Int).SetBytes(bz), nil + if bz == nil { + return types.Supply{ + Cap: big.NewInt(0).Bytes(), + InitialSupply: big.NewInt(0).Bytes(), + Supply: big.NewInt(0).Bytes(), + }, nil + } + var supply types.Supply + k.cdc.MustUnmarshal(bz, &supply) + return supply, nil } diff --git a/x/wrapped-a0gi-base/keeper/msg_server.go b/x/wrapped-a0gi-base/keeper/msg_server.go index b626cab4..ca2ce996 100644 --- a/x/wrapped-a0gi-base/keeper/msg_server.go +++ b/x/wrapped-a0gi-base/keeper/msg_server.go @@ -18,22 +18,30 @@ var _ types.MsgServer = &Keeper{} func (k Keeper) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.MsgBurnResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) minter := common.BytesToAddress(msg.Minter) - supply, err := k.getMinterSupply(ctx, minter) + s, err := k.getMinterSupply(ctx, minter) if err != nil { return nil, err } + supply := new(big.Int).SetBytes(s.Supply) + amount := new(big.Int).SetBytes(msg.Amount) // check & update mint supply supply.Sub(supply, amount) if supply.Cmp(big.NewInt(0)) < 0 { return nil, types.ErrInsufficientMintSupply } - // burn + // transfer from wa0gi contract address & burn c := sdk.NewCoin(precisebanktypes.ExtendedCoinDenom, sdk.NewIntFromBigInt(amount)) + wa0gi := sdk.AccAddress(k.GetWA0GIAddress(ctx)) + if err = k.pbkeeper.SendCoinsFromAccountToModule(ctx, wa0gi, 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 } - if err = k.setMinterSupply(ctx, minter, supply); err != nil { + // update supply + s.Supply = supply.Bytes() + if err = k.setMinterSupply(ctx, minter, s); err != nil { return nil, err } return &types.MsgBurnResponse{}, nil @@ -43,26 +51,31 @@ func (k Keeper) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.MsgBurnR func (k Keeper) Mint(goCtx context.Context, msg *types.MsgMint) (*types.MsgMintResponse, error) { 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) + s, err := k.getMinterSupply(ctx, minter) if err != nil { return nil, err } + supply := new(big.Int).SetBytes(s.Supply) + cap := new(big.Int).SetBytes(s.Cap) + amount := new(big.Int).SetBytes(msg.Amount) // check & update mint supply supply.Add(supply, amount) if supply.Cmp(cap) > 0 { return nil, types.ErrInsufficientMintCap } - // mint + // mint & transfer to wa0gi contract address c := sdk.NewCoin(precisebanktypes.ExtendedCoinDenom, sdk.NewIntFromBigInt(amount)) if err = k.pbkeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(c)); err != nil { return nil, err } - if err = k.setMinterSupply(ctx, minter, supply); err != nil { + wa0gi := sdk.AccAddress(k.GetWA0GIAddress(ctx)) + if err = k.pbkeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, wa0gi, sdk.NewCoins(c)); err != nil { + return nil, err + } + // update supply + s.Supply = supply.Bytes() + if err = k.setMinterSupply(ctx, minter, s); err != nil { return nil, err } return &types.MsgMintResponse{}, nil @@ -76,8 +89,26 @@ func (k Keeper) SetMinterCap(goCtx context.Context, msg *types.MsgSetMinterCap) 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 { + // get previous minter supply + s, err := k.getMinterSupply(ctx, minter) + if err != nil { + return nil, err + } + supply := new(big.Int).SetBytes(s.Supply) + currentInitialSupply := new(big.Int).SetBytes(s.InitialSupply) + newInitialSupply := new(big.Int).SetBytes(msg.InitialSupply) + difference := new(big.Int).Sub(newInitialSupply, currentInitialSupply) + supply.Add(supply, difference) + if supply.Cmp(big.NewInt(0)) < 0 { + supply = big.NewInt(0) + } + + s.Cap = msg.Cap + s.InitialSupply = msg.InitialSupply + s.Supply = supply.Bytes() + + // update minter supply + if err := k.setMinterSupply(ctx, minter, s); err != nil { return nil, err } return &types.MsgSetMinterCapResponse{}, nil diff --git a/x/wrapped-a0gi-base/keeper/msg_server_test.go b/x/wrapped-a0gi-base/keeper/msg_server_test.go index 127d73db..353af804 100644 --- a/x/wrapped-a0gi-base/keeper/msg_server_test.go +++ b/x/wrapped-a0gi-base/keeper/msg_server_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "fmt" "math/big" "testing" @@ -63,43 +62,52 @@ func (s *MsgServerTestSuite) TestSetMinterCap() { testCases := []struct { name string caps []struct { - account common.Address - cap *big.Int + account common.Address + cap *big.Int + initialSupply *big.Int } }{ { name: "success", caps: []struct { - account common.Address - cap *big.Int + account common.Address + cap *big.Int + initialSupply *big.Int }{ { - account: common.HexToAddress("0x0000000000000000000000000000000000000000"), - cap: big.NewInt(100000), + account: common.HexToAddress("0x0000000000000000000000000000000000000000"), + cap: big.NewInt(100000), + initialSupply: big.NewInt(50000), }, { - account: common.HexToAddress("0x0000000000000000000000000000000000000001"), - cap: big.NewInt(200000), + account: common.HexToAddress("0x0000000000000000000000000000000000000001"), + cap: big.NewInt(200000), + initialSupply: big.NewInt(100000), }, { - account: common.HexToAddress("0x0000000000000000000000000000000000000002"), - cap: big.NewInt(300000), + account: common.HexToAddress("0x0000000000000000000000000000000000000002"), + cap: big.NewInt(300000), + initialSupply: big.NewInt(150000), }, { - account: common.HexToAddress("0x0000000000000000000000000000000000000003"), - cap: big.NewInt(400000), + account: common.HexToAddress("0x0000000000000000000000000000000000000003"), + cap: big.NewInt(400000), + initialSupply: big.NewInt(200000), }, { - account: common.HexToAddress("0x0000000000000000000000000000000000000002"), - cap: big.NewInt(500000), + account: common.HexToAddress("0x0000000000000000000000000000000000000002"), + cap: big.NewInt(500000), + initialSupply: big.NewInt(250000), }, { - account: common.HexToAddress("0x0000000000000000000000000000000000000001"), - cap: big.NewInt(600000), + account: common.HexToAddress("0x0000000000000000000000000000000000000001"), + cap: big.NewInt(600000), + initialSupply: big.NewInt(300000), }, { - account: common.HexToAddress("0x0000000000000000000000000000000000000000"), - cap: big.NewInt(700000), + account: common.HexToAddress("0x0000000000000000000000000000000000000000"), + cap: big.NewInt(700000), + initialSupply: big.NewInt(350000), }, }, }, @@ -107,9 +115,10 @@ func (s *MsgServerTestSuite) TestSetMinterCap() { s.Run("invalid authority", func() { s.SetupTest() _, err := s.Keeper.SetMinterCap(sdk.WrapSDKContext(s.Ctx), &types.MsgSetMinterCap{ - Authority: s.Addresses[0].String(), - Minter: common.HexToAddress("0x0000000000000000000000000000000000000000").Bytes(), - Cap: big.NewInt(600000).Bytes(), + Authority: s.Addresses[0].String(), + Minter: common.HexToAddress("0x0000000000000000000000000000000000000000").Bytes(), + Cap: big.NewInt(600000).Bytes(), + InitialSupply: big.NewInt(300000).Bytes(), }) s.Require().Error(err) s.Require().Contains(err.Error(), "expected gov account as only signer for proposal message") @@ -119,27 +128,41 @@ func (s *MsgServerTestSuite) TestSetMinterCap() { s.Run(tc.name, func() { s.SetupTest() - c := make(map[common.Address]*big.Int) + c := make(map[common.Address]struct { + Cap *big.Int + InitialSupply *big.Int + }) for _, cap := range tc.caps { _, err := s.Keeper.SetMinterCap(sdk.WrapSDKContext(s.Ctx), &types.MsgSetMinterCap{ - Authority: govAccAddr, - Minter: cap.account.Bytes(), - Cap: cap.cap.Bytes(), + Authority: govAccAddr, + Minter: cap.account.Bytes(), + Cap: cap.cap.Bytes(), + InitialSupply: cap.initialSupply.Bytes(), }) s.Require().NoError(err) response, err := s.Keeper.MinterSupply(s.Ctx, &types.MinterSupplyRequest{ Address: cap.account.Bytes(), }) s.Require().NoError(err) - s.Require().Equal(new(big.Int).SetBytes(response.Cap), cap.cap) - c[cap.account] = cap.cap + s.Require().Equal(new(big.Int).SetBytes(response.Supply.Cap), cap.cap) + s.Require().Equal(new(big.Int).SetBytes(response.Supply.InitialSupply), cap.initialSupply) + s.Require().Equal(new(big.Int).SetBytes(response.Supply.Supply), cap.initialSupply) + c[cap.account] = struct { + Cap *big.Int + InitialSupply *big.Int + }{ + Cap: cap.cap, + InitialSupply: cap.initialSupply, + } } for account, cap := range c { response, err := s.Keeper.MinterSupply(s.Ctx, &types.MinterSupplyRequest{ Address: account.Bytes(), }) s.Require().NoError(err) - s.Require().Equal(new(big.Int).SetBytes(response.Cap), cap) + s.Require().Equal(new(big.Int).SetBytes(response.Supply.Cap), cap.Cap) + s.Require().Equal(new(big.Int).SetBytes(response.Supply.InitialSupply), cap.InitialSupply) + s.Require().Equal(new(big.Int).SetBytes(response.Supply.Supply), cap.InitialSupply) } }) } @@ -154,8 +177,8 @@ type MintBurn struct { func (s *MsgServerTestSuite) TestSetMintBurn() { precisebankKeeper := s.App.GetPrecisebankKeeper() - accountKeeper := s.App.GetAccountKeeper() - moduleAcc := accountKeeper.GetModuleAccount(s.Ctx, types.ModuleName).GetAddress() + // accountKeeper := s.App.GetAccountKeeper() + // moduleAcc := accountKeeper.GetModuleAccount(s.Ctx, types.ModuleName).GetAddress() govAccAddr := s.GovKeeper.GetGovernanceAccount(s.Ctx).GetAddress().String() minter1 := common.HexToAddress("0x0000000000000000000000000000000000000001") @@ -163,16 +186,18 @@ func (s *MsgServerTestSuite) TestSetMintBurn() { // set mint cap of minter 1 to 8 a0gi _, err := s.Keeper.SetMinterCap(sdk.WrapSDKContext(s.Ctx), &types.MsgSetMinterCap{ - Authority: govAccAddr, - Minter: minter1.Bytes(), - Cap: big.NewInt(8e18).Bytes(), + Authority: govAccAddr, + Minter: minter1.Bytes(), + Cap: big.NewInt(8e18).Bytes(), + InitialSupply: big.NewInt(0).Bytes(), }) s.Require().NoError(err) // set mint cap of minter 2 to 5 a0gi _, err = s.Keeper.SetMinterCap(sdk.WrapSDKContext(s.Ctx), &types.MsgSetMinterCap{ - Authority: govAccAddr, - Minter: minter2.Bytes(), - Cap: big.NewInt(5e18).Bytes(), + Authority: govAccAddr, + Minter: minter2.Bytes(), + Cap: big.NewInt(5e18).Bytes(), + InitialSupply: big.NewInt(0).Bytes(), }) s.Require().NoError(err) @@ -236,8 +261,7 @@ func (s *MsgServerTestSuite) TestSetMintBurn() { } minted := big.NewInt(0) supplied := make(map[common.Address]*big.Int) - for id, c := range testCases { - fmt.Println(id) + for _, c := range testCases { if c.IsMint { _, err = s.Keeper.Mint(sdk.WrapSDKContext(s.Ctx), &types.MsgMint{ Minter: c.Minter.Bytes(), @@ -270,11 +294,12 @@ func (s *MsgServerTestSuite) TestSetMintBurn() { Address: c.Minter.Bytes(), }) s.Require().NoError(err) - s.Require().Equal(supplied[c.Minter].Bytes(), response.Supply) + s.Require().Equal(supplied[c.Minter].Bytes(), response.Supply.Supply) } else { s.Require().Error(err) } - coins := precisebankKeeper.GetBalance(s.Ctx, moduleAcc, precisebanktypes.ExtendedCoinDenom) + wa0gi := sdk.AccAddress(s.Keeper.GetWA0GIAddress(s.Ctx)) + coins := precisebankKeeper.GetBalance(s.Ctx, wa0gi, precisebanktypes.ExtendedCoinDenom) s.Require().Equal(coins.Amount.BigInt(), minted) } } diff --git a/x/wrapped-a0gi-base/types/genesis.pb.go b/x/wrapped-a0gi-base/types/genesis.pb.go index 4d23ee39..f156ddba 100644 --- a/x/wrapped-a0gi-base/types/genesis.pb.go +++ b/x/wrapped-a0gi-base/types/genesis.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: zgc/wrappeda0gibase/genesis.proto +// source: zgc/wrappeda0gibase/v1/genesis.proto package types @@ -36,7 +36,7 @@ func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_7e056019f61fd820, []int{0} + return fileDescriptor_779563aa2ca23b26, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -73,29 +73,31 @@ func (m *GenesisState) GetWrappedA0GiAddress() []byte { } func init() { - proto.RegisterType((*GenesisState)(nil), "zgc.wrappeda0gibase.GenesisState") + proto.RegisterType((*GenesisState)(nil), "zgc.wrappeda0gibase.v1.GenesisState") } -func init() { proto.RegisterFile("zgc/wrappeda0gibase/genesis.proto", fileDescriptor_7e056019f61fd820) } +func init() { + proto.RegisterFile("zgc/wrappeda0gibase/v1/genesis.proto", fileDescriptor_779563aa2ca23b26) +} -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, 0x85, 0x21, 0xea, 0x14, 0x3a, 0xd0, 0x0e, 0xe6, 0x67, 0x62, 0x49, 0x6c, 0x09, - 0x1e, 0x80, 0xb2, 0xb0, 0x31, 0xc0, 0xc6, 0x12, 0xd9, 0x8e, 0xb9, 0x5a, 0x6a, 0x72, 0x56, 0xce, - 0x15, 0x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, 0xdd, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xec, 0x50, - 0x04, 0x4c, 0x3f, 0x01, 0x00, 0x00, +var fileDescriptor_779563aa2ca23b26 = []byte{ + // 253 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xb1, 0x4e, 0xc3, 0x30, + 0x10, 0x86, 0xeb, 0x85, 0x21, 0xea, 0x14, 0x55, 0x88, 0x76, 0x30, 0x08, 0x31, 0xb0, 0x24, 0x76, + 0x05, 0x0f, 0x40, 0x59, 0xd8, 0x18, 0x60, 0x63, 0x89, 0x6c, 0xc7, 0x5c, 0x2d, 0x35, 0x39, 0x2b, + 0xe7, 0x16, 0xda, 0xa7, 0xe0, 0xb1, 0x18, 0x3b, 0x32, 0xa2, 0xe4, 0x45, 0x50, 0xe2, 0xb0, 0x74, + 0xf3, 0xdd, 0xf7, 0x5b, 0xf7, 0xe9, 0x4f, 0x6e, 0x0e, 0x60, 0xc4, 0x47, 0xa3, 0xbc, 0xb7, 0xa5, + 0x92, 0xe0, 0xb4, 0x22, 0x2b, 0x76, 0x4b, 0x01, 0xb6, 0xb6, 0xe4, 0x28, 0xf7, 0x0d, 0x06, 0x4c, + 0xcf, 0x0f, 0x60, 0xf2, 0x93, 0x54, 0xbe, 0x5b, 0x2e, 0xe6, 0x06, 0xa9, 0x42, 0x2a, 0x86, 0x94, + 0x88, 0x43, 0xfc, 0xb2, 0x98, 0x01, 0x02, 0xc6, 0x7d, 0xff, 0x1a, 0xb7, 0x73, 0x40, 0x84, 0x8d, + 0x15, 0xc3, 0xa4, 0xb7, 0xef, 0x42, 0xd5, 0xfb, 0x11, 0x5d, 0x9e, 0xa2, 0xe0, 0x2a, 0x4b, 0x41, + 0x55, 0x3e, 0x06, 0xae, 0x1f, 0x92, 0xe9, 0x53, 0xb4, 0x7a, 0x0d, 0x2a, 0xd8, 0x54, 0x26, 0xb3, + 0x51, 0xa9, 0xe8, 0x9d, 0x0a, 0x55, 0x96, 0x8d, 0x25, 0xba, 0x60, 0x57, 0xec, 0x76, 0xfa, 0x92, + 0x8e, 0x6c, 0x25, 0xc1, 0xad, 0x22, 0x79, 0x7c, 0xfe, 0x6e, 0x39, 0x3b, 0xb6, 0x9c, 0xfd, 0xb6, + 0x9c, 0x7d, 0x75, 0x7c, 0x72, 0xec, 0xf8, 0xe4, 0xa7, 0xe3, 0x93, 0xb7, 0x7b, 0x70, 0x61, 0xbd, + 0xd5, 0xb9, 0xc1, 0x4a, 0x48, 0xd8, 0x28, 0x4d, 0x42, 0x42, 0x66, 0xd6, 0xca, 0xd5, 0xe2, 0xf3, + 0xbf, 0x9f, 0xac, 0x3f, 0x93, 0x0d, 0x0d, 0x85, 0xbd, 0xb7, 0xa4, 0xcf, 0x06, 0xb1, 0xbb, 0xbf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x49, 0x21, 0xfe, 0x45, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/wrapped-a0gi-base/types/keys.go b/x/wrapped-a0gi-base/types/keys.go index 91fec8c1..71d85449 100644 --- a/x/wrapped-a0gi-base/types/keys.go +++ b/x/wrapped-a0gi-base/types/keys.go @@ -15,7 +15,6 @@ const ( var ( // prefix - MinterCapKeyPrefix = []byte{0x00} MinterSupplyKeyPrefix = []byte{0x01} // keys diff --git a/x/wrapped-a0gi-base/types/query.pb.go b/x/wrapped-a0gi-base/types/query.pb.go index ed2753b2..d55c43f2 100644 --- a/x/wrapped-a0gi-base/types/query.pb.go +++ b/x/wrapped-a0gi-base/types/query.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: zgc/wrappeda0gibase/query.proto +// source: zgc/wrappeda0gibase/v1/query.proto package types @@ -39,7 +39,7 @@ 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} + return fileDescriptor_55673b89eaf499d1, []int{0} } func (m *GetWA0GIRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -76,7 +76,7 @@ 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} + return fileDescriptor_55673b89eaf499d1, []int{1} } func (m *GetWA0GIResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -113,7 +113,7 @@ 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{2} + return fileDescriptor_55673b89eaf499d1, []int{2} } func (m *MinterSupplyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -143,15 +143,14 @@ func (m *MinterSupplyRequest) XXX_DiscardUnknown() { var xxx_messageInfo_MinterSupplyRequest proto.InternalMessageInfo type MinterSupplyResponse struct { - Cap []byte `protobuf:"bytes,1,opt,name=cap,proto3" json:"cap,omitempty"` - Supply []byte `protobuf:"bytes,2,opt,name=supply,proto3" json:"supply,omitempty"` + Supply *Supply `protobuf:"bytes,1,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{3} + return fileDescriptor_55673b89eaf499d1, []int{3} } func (m *MinterSupplyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -181,42 +180,45 @@ 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") + proto.RegisterType((*GetWA0GIRequest)(nil), "zgc.wrappeda0gibase.v1.GetWA0GIRequest") + proto.RegisterType((*GetWA0GIResponse)(nil), "zgc.wrappeda0gibase.v1.GetWA0GIResponse") + proto.RegisterType((*MinterSupplyRequest)(nil), "zgc.wrappeda0gibase.v1.MinterSupplyRequest") + proto.RegisterType((*MinterSupplyResponse)(nil), "zgc.wrappeda0gibase.v1.MinterSupplyResponse") } -func init() { proto.RegisterFile("zgc/wrappeda0gibase/query.proto", fileDescriptor_19911faa2ec12c75) } +func init() { + proto.RegisterFile("zgc/wrappeda0gibase/v1/query.proto", fileDescriptor_55673b89eaf499d1) +} -var fileDescriptor_19911faa2ec12c75 = []byte{ - // 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, 0x53, 0x46, 0x59, 0x51, 0xcf, 0x57, 0xba, 0xfa, 0x92, 0x32, 0x46, 0xa7, 0x04, 0x61, - 0x1e, 0x21, 0x9c, 0x24, 0x4c, 0x62, 0x19, 0xb1, 0xa4, 0xec, 0xe9, 0xea, 0x5d, 0xa5, 0x82, 0xec, - 0x3f, 0xc2, 0x89, 0x1e, 0x6f, 0xf5, 0xf6, 0xb7, 0x64, 0x14, 0x13, 0x21, 0x71, 0xcc, 0x0b, 0xc0, - 0x79, 0x0e, 0x9e, 0x0d, 0x89, 0xfc, 0xf3, 0xcd, 0x1f, 0xfe, 0x18, 0x91, 0x59, 0x46, 0x84, 0x74, - 0x3e, 0x82, 0xe6, 0x75, 0x49, 0x70, 0x96, 0x08, 0x02, 0x3b, 0xe0, 0x09, 0x1e, 0x8f, 0x53, 0x22, - 0x44, 0xc7, 0x7c, 0x65, 0x0e, 0x1a, 0xa3, 0x52, 0x3a, 0x08, 0xb4, 0x7e, 0x46, 0x89, 0x24, 0xe9, - 0xef, 0x8c, 0xf3, 0xe9, 0x42, 0x1f, 0x72, 0x47, 0xc3, 0x57, 0xd0, 0xbe, 0xdd, 0xa0, 0x47, 0x34, - 0xc1, 0xa3, 0x10, 0x73, 0x4d, 0xe7, 0x4b, 0xf8, 0x02, 0xd4, 0x85, 0x62, 0x3a, 0x35, 0x55, 0xd4, - 0xea, 0xd3, 0x49, 0x0d, 0x3c, 0xfe, 0x95, 0x67, 0x0c, 0x0f, 0x4d, 0xf0, 0xb4, 0xf4, 0x0a, 0xdf, - 0x7a, 0x15, 0x59, 0x7b, 0x7b, 0xb7, 0xb3, 0xfa, 0xf7, 0x50, 0x85, 0x1b, 0xe7, 0xdd, 0xd1, 0xe9, - 0xe5, 0x71, 0xed, 0x35, 0xec, 0x21, 0x9f, 0x96, 0x0f, 0xec, 0xe6, 0xb8, 0xab, 0x9e, 0x98, 0x12, - 0xe9, 0xce, 0x73, 0x09, 0x57, 0x26, 0x68, 0xdc, 0xbc, 0x0f, 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, +var fileDescriptor_55673b89eaf499d1 = []byte{ + // 418 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0xcb, 0xd3, 0x30, + 0x18, 0xc7, 0xdb, 0x17, 0x7c, 0x95, 0xf8, 0x82, 0x1a, 0x5f, 0x64, 0x2b, 0x92, 0x69, 0x45, 0x36, + 0xd8, 0xda, 0x74, 0x53, 0xbc, 0xeb, 0x65, 0x78, 0x50, 0x70, 0x1e, 0x04, 0x2f, 0x92, 0x76, 0x31, + 0x2b, 0xac, 0x4d, 0xd6, 0xa4, 0x9b, 0xdb, 0xd1, 0x83, 0x67, 0x41, 0xf0, 0x3b, 0xf8, 0x4d, 0x76, + 0x1c, 0x78, 0xf1, 0xa8, 0x9b, 0x1f, 0x44, 0x9a, 0xa6, 0xa8, 0xa5, 0xd3, 0xf7, 0xd6, 0xe7, 0xc9, + 0xff, 0x97, 0xe7, 0xff, 0xfc, 0x1b, 0xe0, 0x6e, 0x58, 0x84, 0x57, 0x19, 0x11, 0x82, 0x4e, 0x49, + 0xc0, 0xe2, 0x90, 0x48, 0x8a, 0x97, 0x43, 0xbc, 0xc8, 0x69, 0xb6, 0xf6, 0x45, 0xc6, 0x15, 0x87, + 0xb7, 0x36, 0x2c, 0xf2, 0x6b, 0x1a, 0x7f, 0x39, 0x74, 0xda, 0x11, 0x97, 0x09, 0x97, 0x6f, 0xb4, + 0x0a, 0x97, 0x45, 0x89, 0x38, 0xe7, 0x8c, 0x33, 0x5e, 0xf6, 0x8b, 0x2f, 0xd3, 0xbd, 0xcd, 0x38, + 0x67, 0x73, 0x8a, 0x89, 0x88, 0x31, 0x49, 0x53, 0xae, 0x88, 0x8a, 0x79, 0x5a, 0x31, 0x6d, 0x73, + 0xaa, 0xab, 0x30, 0x7f, 0x8b, 0x49, 0x6a, 0x1c, 0x38, 0x9d, 0xfa, 0x91, 0x8a, 0x13, 0x2a, 0x15, + 0x49, 0x84, 0x11, 0x0c, 0x8e, 0xac, 0x51, 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0x59, 0xbb, 0x03, 0xb2, 0xbe, + 0x1d, 0x90, 0xf5, 0xfa, 0x21, 0x8b, 0xd5, 0x2c, 0x0f, 0xfd, 0x88, 0x27, 0x38, 0x60, 0x73, 0x12, + 0x4a, 0x1c, 0x30, 0x2f, 0x9a, 0x91, 0x38, 0xc5, 0xef, 0x1a, 0xee, 0x56, 0x6b, 0x41, 0x65, 0x78, + 0xaa, 0x1f, 0xd2, 0x83, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x94, 0xc8, 0xa7, 0x60, 0x3f, 0x03, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -245,7 +247,7 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { 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...) + err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.v1.Query/GetWA0GI", in, out, opts...) if err != nil { return nil, err } @@ -254,7 +256,7 @@ func (c *queryClient) GetWA0GI(ctx context.Context, in *GetWA0GIRequest, opts .. 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...) + err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.v1.Query/MinterSupply", in, out, opts...) if err != nil { return nil, err } @@ -292,7 +294,7 @@ func _Query_GetWA0GI_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zgc.wrappeda0gibase.Query/GetWA0GI", + FullMethod: "/zgc.wrappeda0gibase.v1.Query/GetWA0GI", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).GetWA0GI(ctx, req.(*GetWA0GIRequest)) @@ -310,7 +312,7 @@ func _Query_MinterSupply_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zgc.wrappeda0gibase.Query/MinterSupply", + FullMethod: "/zgc.wrappeda0gibase.v1.Query/MinterSupply", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).MinterSupply(ctx, req.(*MinterSupplyRequest)) @@ -319,7 +321,7 @@ func _Query_MinterSupply_Handler(srv interface{}, ctx context.Context, dec func( } var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "zgc.wrappeda0gibase.Query", + ServiceName: "zgc.wrappeda0gibase.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { @@ -332,7 +334,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "zgc/wrappeda0gibase/query.proto", + Metadata: "zgc/wrappeda0gibase/v1/query.proto", } func (m *GetWA0GIRequest) Marshal() (dAtA []byte, err error) { @@ -438,17 +440,15 @@ func (m *MinterSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Supply) > 0 { - i -= len(m.Supply) - copy(dAtA[i:], m.Supply) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Supply))) - i-- - dAtA[i] = 0x12 - } - if len(m.Cap) > 0 { - i -= len(m.Cap) - copy(dAtA[i:], m.Cap) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Cap))) + if m.Supply != nil { + { + size, err := m.Supply.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -507,12 +507,8 @@ func (m *MinterSupplyResponse) Size() (n int) { } var l int _ = l - l = len(m.Cap) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Supply) - if l > 0 { + if m.Supply != nil { + l = m.Supply.Size() n += 1 + l + sovQuery(uint64(l)) } return n @@ -772,44 +768,10 @@ func (m *MinterSupplyResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cap", 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.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 byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -819,24 +781,26 @@ func (m *MinterSupplyResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Supply = append(m.Supply[:0], dAtA[iNdEx:postIndex]...) if m.Supply == nil { - m.Supply = []byte{} + m.Supply = &Supply{} + } + if err := m.Supply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: diff --git a/x/wrapped-a0gi-base/types/query.pb.gw.go b/x/wrapped-a0gi-base/types/query.pb.gw.go index 17f15012..5c1eb341 100644 --- a/x/wrapped-a0gi-base/types/query.pb.gw.go +++ b/x/wrapped-a0gi-base/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: zgc/wrappeda0gibase/query.proto +// source: zgc/wrappeda0gibase/v1/query.proto /* Package types is a reverse proxy. diff --git a/x/wrapped-a0gi-base/types/tx.pb.go b/x/wrapped-a0gi-base/types/tx.pb.go index 87358084..b091f3be 100644 --- a/x/wrapped-a0gi-base/types/tx.pb.go +++ b/x/wrapped-a0gi-base/types/tx.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: zgc/wrappeda0gibase/tx.proto +// source: zgc/wrappeda0gibase/v1/tx.proto package types @@ -39,7 +39,7 @@ func (m *MsgSetWA0GI) Reset() { *m = MsgSetWA0GI{} } func (m *MsgSetWA0GI) String() string { return proto.CompactTextString(m) } func (*MsgSetWA0GI) ProtoMessage() {} func (*MsgSetWA0GI) Descriptor() ([]byte, []int) { - return fileDescriptor_f80bf93a1fc022d3, []int{0} + return fileDescriptor_8ad0b49b2e65b5cc, []int{0} } func (m *MsgSetWA0GI) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -75,7 +75,7 @@ func (m *MsgSetWA0GIResponse) Reset() { *m = MsgSetWA0GIResponse{} } func (m *MsgSetWA0GIResponse) String() string { return proto.CompactTextString(m) } func (*MsgSetWA0GIResponse) ProtoMessage() {} func (*MsgSetWA0GIResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f80bf93a1fc022d3, []int{1} + return fileDescriptor_8ad0b49b2e65b5cc, []int{1} } func (m *MsgSetWA0GIResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -105,16 +105,17 @@ func (m *MsgSetWA0GIResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetWA0GIResponse proto.InternalMessageInfo type MsgSetMinterCap struct { - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,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"` + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,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"` + InitialSupply []byte `protobuf:"bytes,4,opt,name=initialSupply,proto3" json:"initialSupply,omitempty"` } func (m *MsgSetMinterCap) Reset() { *m = MsgSetMinterCap{} } func (m *MsgSetMinterCap) String() string { return proto.CompactTextString(m) } func (*MsgSetMinterCap) ProtoMessage() {} func (*MsgSetMinterCap) Descriptor() ([]byte, []int) { - return fileDescriptor_f80bf93a1fc022d3, []int{2} + return fileDescriptor_8ad0b49b2e65b5cc, []int{2} } func (m *MsgSetMinterCap) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -150,7 +151,7 @@ func (m *MsgSetMinterCapResponse) Reset() { *m = MsgSetMinterCapResponse func (m *MsgSetMinterCapResponse) String() string { return proto.CompactTextString(m) } func (*MsgSetMinterCapResponse) ProtoMessage() {} func (*MsgSetMinterCapResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f80bf93a1fc022d3, []int{3} + return fileDescriptor_8ad0b49b2e65b5cc, []int{3} } func (m *MsgSetMinterCapResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -188,7 +189,7 @@ func (m *MsgMint) Reset() { *m = MsgMint{} } func (m *MsgMint) String() string { return proto.CompactTextString(m) } func (*MsgMint) ProtoMessage() {} func (*MsgMint) Descriptor() ([]byte, []int) { - return fileDescriptor_f80bf93a1fc022d3, []int{4} + return fileDescriptor_8ad0b49b2e65b5cc, []int{4} } func (m *MsgMint) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -224,7 +225,7 @@ func (m *MsgMintResponse) Reset() { *m = MsgMintResponse{} } func (m *MsgMintResponse) String() string { return proto.CompactTextString(m) } func (*MsgMintResponse) ProtoMessage() {} func (*MsgMintResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f80bf93a1fc022d3, []int{5} + return fileDescriptor_8ad0b49b2e65b5cc, []int{5} } func (m *MsgMintResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -262,7 +263,7 @@ func (m *MsgBurn) Reset() { *m = MsgBurn{} } func (m *MsgBurn) String() string { return proto.CompactTextString(m) } func (*MsgBurn) ProtoMessage() {} func (*MsgBurn) Descriptor() ([]byte, []int) { - return fileDescriptor_f80bf93a1fc022d3, []int{6} + return fileDescriptor_8ad0b49b2e65b5cc, []int{6} } func (m *MsgBurn) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -298,7 +299,7 @@ func (m *MsgBurnResponse) Reset() { *m = MsgBurnResponse{} } func (m *MsgBurnResponse) String() string { return proto.CompactTextString(m) } func (*MsgBurnResponse) ProtoMessage() {} func (*MsgBurnResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f80bf93a1fc022d3, []int{7} + return fileDescriptor_8ad0b49b2e65b5cc, []int{7} } func (m *MsgBurnResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -328,47 +329,49 @@ func (m *MsgBurnResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBurnResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgSetWA0GI)(nil), "zgc.wrappeda0gibase.MsgSetWA0GI") - proto.RegisterType((*MsgSetWA0GIResponse)(nil), "zgc.wrappeda0gibase.MsgSetWA0GIResponse") - proto.RegisterType((*MsgSetMinterCap)(nil), "zgc.wrappeda0gibase.MsgSetMinterCap") - proto.RegisterType((*MsgSetMinterCapResponse)(nil), "zgc.wrappeda0gibase.MsgSetMinterCapResponse") - proto.RegisterType((*MsgMint)(nil), "zgc.wrappeda0gibase.MsgMint") - proto.RegisterType((*MsgMintResponse)(nil), "zgc.wrappeda0gibase.MsgMintResponse") - proto.RegisterType((*MsgBurn)(nil), "zgc.wrappeda0gibase.MsgBurn") - proto.RegisterType((*MsgBurnResponse)(nil), "zgc.wrappeda0gibase.MsgBurnResponse") + proto.RegisterType((*MsgSetWA0GI)(nil), "zgc.wrappeda0gibase.v1.MsgSetWA0GI") + proto.RegisterType((*MsgSetWA0GIResponse)(nil), "zgc.wrappeda0gibase.v1.MsgSetWA0GIResponse") + proto.RegisterType((*MsgSetMinterCap)(nil), "zgc.wrappeda0gibase.v1.MsgSetMinterCap") + proto.RegisterType((*MsgSetMinterCapResponse)(nil), "zgc.wrappeda0gibase.v1.MsgSetMinterCapResponse") + proto.RegisterType((*MsgMint)(nil), "zgc.wrappeda0gibase.v1.MsgMint") + proto.RegisterType((*MsgMintResponse)(nil), "zgc.wrappeda0gibase.v1.MsgMintResponse") + proto.RegisterType((*MsgBurn)(nil), "zgc.wrappeda0gibase.v1.MsgBurn") + proto.RegisterType((*MsgBurnResponse)(nil), "zgc.wrappeda0gibase.v1.MsgBurnResponse") } -func init() { proto.RegisterFile("zgc/wrappeda0gibase/tx.proto", fileDescriptor_f80bf93a1fc022d3) } +func init() { proto.RegisterFile("zgc/wrappeda0gibase/v1/tx.proto", fileDescriptor_8ad0b49b2e65b5cc) } -var fileDescriptor_f80bf93a1fc022d3 = []byte{ - // 419 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xc1, 0xae, 0xd2, 0x40, - 0x14, 0x86, 0x5b, 0x30, 0x20, 0x23, 0x89, 0x5a, 0x14, 0x4b, 0x43, 0x1a, 0xd2, 0xb0, 0x60, 0x21, - 0x9d, 0x46, 0xdd, 0xb8, 0x14, 0x63, 0x8c, 0x26, 0xdd, 0xd4, 0x44, 0xa3, 0x1b, 0x33, 0x2d, 0xe3, - 0xd0, 0x84, 0x76, 0x9a, 0xce, 0x34, 0x02, 0x4f, 0xe1, 0x63, 0xb1, 0x64, 0xa9, 0x3b, 0x2f, 0xbc, - 0xc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, 0x5e, 0xe1, 0xa9, 0x07, 0xbc, 0x2e, 0x68, 0xa0, 0x88, 0x66, - 0x31, 0x2f, 0xf6, 0xe4, 0x95, 0xf5, 0x54, 0x7e, 0xb0, 0x18, 0x3d, 0xa2, 0x4d, 0xb2, 0x34, 0xbe, - 0x27, 0x4d, 0x8c, 0x16, 0xb4, 0x57, 0xff, 0x6a, 0xa0, 0xee, 0x32, 0xa2, 0x7d, 0x05, 0x0f, 0xcb, - 0xd0, 0x07, 0xf6, 0x2d, 0x7f, 0xd9, 0xae, 0xe4, 0x69, 0x8c, 0x2e, 0x39, 0x0a, 0xbe, 0xe6, 0x83, - 0xf6, 0x41, 0xdc, 0xc3, 0x33, 0x93, 0xa5, 0xcb, 0x78, 0x79, 0x17, 0x57, 0xb9, 0xe3, 0x33, 0x78, - 0x20, 0xc3, 0xed, 0x9f, 0x9a, 0x12, 0x5d, 0x63, 0x78, 0xae, 0x5b, 0x65, 0xc9, 0x68, 0x4f, 0xb2, - 0x44, 0xf7, 0x34, 0xab, 0x9a, 0xed, 0xc4, 0x5b, 0x5f, 0x99, 0xca, 0x7a, 0x6b, 0xaa, 0x9b, 0xad, - 0xa9, 0xfe, 0xdf, 0x9a, 0xea, 0x9f, 0x9d, 0xa9, 0x6c, 0x76, 0xa6, 0xf2, 0x77, 0x67, 0x2a, 0x3f, - 0xde, 0x90, 0x90, 0xcf, 0x32, 0xdf, 0x0e, 0x68, 0x04, 0x1d, 0x32, 0x47, 0x3e, 0x83, 0x0e, 0x19, - 0x07, 0x33, 0x14, 0xc6, 0x70, 0x51, 0x5c, 0xe0, 0x58, 0xc0, 0xc7, 0xf9, 0x0d, 0x2e, 0x13, 0xcc, - 0xfc, 0x86, 0x3c, 0x93, 0xd7, 0xd7, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa7, 0x07, 0x50, 0x07, 0xa7, - 0x03, 0x00, 0x00, +var fileDescriptor_8ad0b49b2e65b5cc = []byte{ + // 450 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0x4f, 0x6f, 0xd3, 0x30, + 0x14, 0x6f, 0xd6, 0xa9, 0x63, 0x8f, 0x21, 0x20, 0x40, 0x49, 0x23, 0x94, 0x4d, 0x01, 0x69, 0x93, + 0x50, 0xe3, 0x0e, 0xb8, 0x70, 0x64, 0x08, 0x21, 0x0e, 0x95, 0x50, 0x77, 0x40, 0x42, 0x48, 0xc8, + 0x49, 0x8d, 0x6b, 0x29, 0x89, 0xad, 0xd8, 0x19, 0xcb, 0x2e, 0x7c, 0x05, 0x3e, 0xd6, 0x8e, 0x3b, + 0x72, 0x84, 0xf6, 0x13, 0xf0, 0x0d, 0x90, 0x9d, 0x26, 0xa4, 0x15, 0xca, 0x2a, 0x6e, 0x7e, 0x3f, + 0xff, 0xfe, 0xbc, 0x3c, 0xe7, 0xc1, 0xfe, 0x05, 0x8d, 0xd0, 0xd7, 0x0c, 0x0b, 0x41, 0xa6, 0x78, + 0x44, 0x59, 0x88, 0x25, 0x41, 0x67, 0xc7, 0x48, 0x9d, 0x07, 0x22, 0xe3, 0x8a, 0xdb, 0xfd, 0x0b, + 0x1a, 0x05, 0x6b, 0x84, 0xe0, 0xec, 0xd8, 0x1d, 0x44, 0x5c, 0x26, 0x5c, 0x7e, 0x36, 0x2c, 0x54, + 0x16, 0xa5, 0xc4, 0xbd, 0x4f, 0x39, 0xe5, 0x25, 0xae, 0x4f, 0x4b, 0x74, 0x40, 0x39, 0xa7, 0x31, + 0x41, 0xa6, 0x0a, 0xf3, 0x2f, 0x08, 0xa7, 0x45, 0x79, 0xe5, 0xbf, 0x81, 0x9b, 0x63, 0x49, 0x4f, + 0x89, 0xfa, 0xf0, 0x6a, 0xf4, 0xf6, 0x9d, 0xfd, 0x08, 0x76, 0x71, 0xae, 0x66, 0x3c, 0x63, 0xaa, + 0x70, 0xac, 0x03, 0xeb, 0x68, 0x77, 0xf2, 0x17, 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d4, 0x84, 0x56, + 0xc7, 0xe6, 0xcc, 0x4f, 0x26, 0x97, 0xbf, 0xbc, 0xce, 0xe5, 0xdc, 0xb3, 0xae, 0xe6, 0x9e, 0xf5, + 0x73, 0xee, 0x59, 0xdf, 0x17, 0x5e, 0xe7, 0x6a, 0xe1, 0x75, 0x7e, 0x2c, 0xbc, 0xce, 0xc7, 0x17, + 0x94, 0xa9, 0x59, 0x1e, 0x06, 0x11, 0x4f, 0xd0, 0x88, 0xc6, 0x38, 0x94, 0x68, 0x44, 0x87, 0xd1, + 0x0c, 0xb3, 0x14, 0x9d, 0x57, 0x5b, 0x3c, 0xd4, 0xfe, 0x43, 0xb3, 0xc7, 0xaa, 0x10, 0x44, 0x86, + 0x3d, 0xb3, 0x64, 0xcf, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x6b, 0x2f, 0x78, 0xeb, 0x03, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -399,7 +402,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { func (c *msgClient) SetWA0GI(ctx context.Context, in *MsgSetWA0GI, opts ...grpc.CallOption) (*MsgSetWA0GIResponse, error) { out := new(MsgSetWA0GIResponse) - err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.Msg/SetWA0GI", in, out, opts...) + err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.v1.Msg/SetWA0GI", in, out, opts...) if err != nil { return nil, err } @@ -408,7 +411,7 @@ func (c *msgClient) SetWA0GI(ctx context.Context, in *MsgSetWA0GI, opts ...grpc. func (c *msgClient) SetMinterCap(ctx context.Context, in *MsgSetMinterCap, opts ...grpc.CallOption) (*MsgSetMinterCapResponse, error) { out := new(MsgSetMinterCapResponse) - err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.Msg/SetMinterCap", in, out, opts...) + err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.v1.Msg/SetMinterCap", in, out, opts...) if err != nil { return nil, err } @@ -417,7 +420,7 @@ func (c *msgClient) SetMinterCap(ctx context.Context, in *MsgSetMinterCap, opts func (c *msgClient) Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) { out := new(MsgMintResponse) - err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.Msg/Mint", in, out, opts...) + err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.v1.Msg/Mint", in, out, opts...) if err != nil { return nil, err } @@ -426,7 +429,7 @@ func (c *msgClient) Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOpti func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) { out := new(MsgBurnResponse) - err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.Msg/Burn", in, out, opts...) + err := c.cc.Invoke(ctx, "/zgc.wrappeda0gibase.v1.Msg/Burn", in, out, opts...) if err != nil { return nil, err } @@ -472,7 +475,7 @@ func _Msg_SetWA0GI_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zgc.wrappeda0gibase.Msg/SetWA0GI", + FullMethod: "/zgc.wrappeda0gibase.v1.Msg/SetWA0GI", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).SetWA0GI(ctx, req.(*MsgSetWA0GI)) @@ -490,7 +493,7 @@ func _Msg_SetMinterCap_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zgc.wrappeda0gibase.Msg/SetMinterCap", + FullMethod: "/zgc.wrappeda0gibase.v1.Msg/SetMinterCap", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).SetMinterCap(ctx, req.(*MsgSetMinterCap)) @@ -508,7 +511,7 @@ func _Msg_Mint_Handler(srv interface{}, ctx context.Context, dec func(interface{ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zgc.wrappeda0gibase.Msg/Mint", + FullMethod: "/zgc.wrappeda0gibase.v1.Msg/Mint", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).Mint(ctx, req.(*MsgMint)) @@ -526,7 +529,7 @@ func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zgc.wrappeda0gibase.Msg/Burn", + FullMethod: "/zgc.wrappeda0gibase.v1.Msg/Burn", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).Burn(ctx, req.(*MsgBurn)) @@ -535,7 +538,7 @@ func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{ } var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "zgc.wrappeda0gibase.Msg", + ServiceName: "zgc.wrappeda0gibase.v1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { @@ -556,7 +559,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "zgc/wrappeda0gibase/tx.proto", + Metadata: "zgc/wrappeda0gibase/v1/tx.proto", } func (m *MsgSetWA0GI) Marshal() (dAtA []byte, err error) { @@ -639,6 +642,13 @@ func (m *MsgSetMinterCap) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.InitialSupply) > 0 { + i -= len(m.InitialSupply) + copy(dAtA[i:], m.InitialSupply) + i = encodeVarintTx(dAtA, i, uint64(len(m.InitialSupply))) + i-- + dAtA[i] = 0x22 + } if len(m.Cap) > 0 { i -= len(m.Cap) copy(dAtA[i:], m.Cap) @@ -861,6 +871,10 @@ func (m *MsgSetMinterCap) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.InitialSupply) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -1226,6 +1240,40 @@ func (m *MsgSetMinterCap) Unmarshal(dAtA []byte) error { m.Cap = []byte{} } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialSupply", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialSupply = append(m.InitialSupply[:0], dAtA[iNdEx:postIndex]...) + if m.InitialSupply == nil { + m.InitialSupply = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/wrapped-a0gi-base/types/wrappeda0gibase.pb.go b/x/wrapped-a0gi-base/types/wrappeda0gibase.pb.go new file mode 100644 index 00000000..c8eef72d --- /dev/null +++ b/x/wrapped-a0gi-base/types/wrappeda0gibase.pb.go @@ -0,0 +1,416 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: zgc/wrappeda0gibase/v1/wrappeda0gibase.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Supply struct { + Cap []byte `protobuf:"bytes,1,opt,name=cap,proto3" json:"cap,omitempty"` + InitialSupply []byte `protobuf:"bytes,2,opt,name=initialSupply,proto3" json:"initialSupply,omitempty"` + Supply []byte `protobuf:"bytes,3,opt,name=supply,proto3" json:"supply,omitempty"` +} + +func (m *Supply) Reset() { *m = Supply{} } +func (m *Supply) String() string { return proto.CompactTextString(m) } +func (*Supply) ProtoMessage() {} +func (*Supply) Descriptor() ([]byte, []int) { + return fileDescriptor_063c93b02245297e, []int{0} +} +func (m *Supply) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Supply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Supply.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 *Supply) XXX_Merge(src proto.Message) { + xxx_messageInfo_Supply.Merge(m, src) +} +func (m *Supply) XXX_Size() int { + return m.Size() +} +func (m *Supply) XXX_DiscardUnknown() { + xxx_messageInfo_Supply.DiscardUnknown(m) +} + +var xxx_messageInfo_Supply proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Supply)(nil), "zgc.wrappeda0gibase.v1.Supply") +} + +func init() { + proto.RegisterFile("zgc/wrappeda0gibase/v1/wrappeda0gibase.proto", fileDescriptor_063c93b02245297e) +} + +var fileDescriptor_063c93b02245297e = []byte{ + // 275 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xc1, 0x4a, 0xf3, 0x40, + 0x14, 0x85, 0x93, 0xbf, 0x90, 0x45, 0xf8, 0x05, 0x09, 0x52, 0xda, 0x22, 0xa3, 0x88, 0x0b, 0x17, + 0x26, 0x93, 0xa2, 0x4f, 0xe0, 0x23, 0xd4, 0x8d, 0xb8, 0x91, 0x9b, 0x71, 0x9c, 0x0e, 0x24, 0x73, + 0x87, 0xce, 0xa4, 0x9a, 0x3e, 0x85, 0x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0x17, 0x25, 0x14, 0x86, 0xe6, + 0x22, 0x65, 0x6b, 0x90, 0x8a, 0x7e, 0x1c, 0xe7, 0x4c, 0xfb, 0xd1, 0x52, 0xb7, 0xb1, 0x6d, 0x34, + 0x37, 0x45, 0xe4, 0x9e, 0xbe, 0xfb, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x5a, 0x50, 0x5b, 0x98, 0x87, + 0x01, 0x00, 0x00, +} + +func (m *Supply) 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 *Supply) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Supply) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Supply) > 0 { + i -= len(m.Supply) + copy(dAtA[i:], m.Supply) + i = encodeVarintWrappeda0Gibase(dAtA, i, uint64(len(m.Supply))) + i-- + dAtA[i] = 0x1a + } + if len(m.InitialSupply) > 0 { + i -= len(m.InitialSupply) + copy(dAtA[i:], m.InitialSupply) + i = encodeVarintWrappeda0Gibase(dAtA, i, uint64(len(m.InitialSupply))) + i-- + dAtA[i] = 0x12 + } + if len(m.Cap) > 0 { + i -= len(m.Cap) + copy(dAtA[i:], m.Cap) + i = encodeVarintWrappeda0Gibase(dAtA, i, uint64(len(m.Cap))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintWrappeda0Gibase(dAtA []byte, offset int, v uint64) int { + offset -= sovWrappeda0Gibase(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Supply) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Cap) + if l > 0 { + n += 1 + l + sovWrappeda0Gibase(uint64(l)) + } + l = len(m.InitialSupply) + if l > 0 { + n += 1 + l + sovWrappeda0Gibase(uint64(l)) + } + l = len(m.Supply) + if l > 0 { + n += 1 + l + sovWrappeda0Gibase(uint64(l)) + } + return n +} + +func sovWrappeda0Gibase(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozWrappeda0Gibase(x uint64) (n int) { + return sovWrappeda0Gibase(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Supply) 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 ErrIntOverflowWrappeda0Gibase + } + 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: Supply: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Supply: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cap", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappeda0Gibase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWrappeda0Gibase + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWrappeda0Gibase + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + 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 InitialSupply", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappeda0Gibase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWrappeda0Gibase + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWrappeda0Gibase + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialSupply = append(m.InitialSupply[:0], dAtA[iNdEx:postIndex]...) + if m.InitialSupply == nil { + m.InitialSupply = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Supply", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappeda0Gibase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWrappeda0Gibase + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWrappeda0Gibase + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Supply = append(m.Supply[:0], dAtA[iNdEx:postIndex]...) + if m.Supply == nil { + m.Supply = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWrappeda0Gibase(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWrappeda0Gibase + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipWrappeda0Gibase(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, ErrIntOverflowWrappeda0Gibase + } + 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, ErrIntOverflowWrappeda0Gibase + } + 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, ErrIntOverflowWrappeda0Gibase + } + 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, ErrInvalidLengthWrappeda0Gibase + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupWrappeda0Gibase + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthWrappeda0Gibase + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthWrappeda0Gibase = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowWrappeda0Gibase = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupWrappeda0Gibase = fmt.Errorf("proto: unexpected end of group") +)