Compare commits

...

4 Commits

Author SHA1 Message Date
Hack666r
0e9ff0e7ee
Merge aaeb15cd0f into ac043ff438 2025-01-20 15:13:54 +08:00
MiniFrenchBread
ac043ff438 feat: refactor wrapped a0gi base 2025-01-20 15:13:31 +08:00
0g-wh
e6b13d85a1 v0.5.0 upgrade 2025-01-17 10:37:19 +08:00
Hack666r
aaeb15cd0f
Typo fix proto-docs.md 2025-01-13 20:30:21 +01:00
25 changed files with 825 additions and 515 deletions

View File

@ -3,21 +3,16 @@ package app
import (
"fmt"
sdkmath "cosmossdk.io/math"
evmutilkeeper "github.com/0glabs/0g-chain/x/evmutil/keeper"
evmutiltypes "github.com/0glabs/0g-chain/x/evmutil/types"
precisebankkeeper "github.com/0glabs/0g-chain/x/precisebank/keeper"
precisebanktypes "github.com/0glabs/0g-chain/x/precisebank/types"
wrappeda0gibasetypes "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)
const (
UpgradeName_Testnet = "v0.4.0"
UpgradeName_Testnet = "v0.5.0"
)
// RegisterUpgradeHandlers registers the upgrade handlers for the app.
@ -37,7 +32,7 @@ func (app App) RegisterUpgradeHandlers() {
if doUpgrade && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{
precisebanktypes.ModuleName,
wrappeda0gibasetypes.ModuleName,
},
}
@ -65,204 +60,12 @@ func upgradeHandler(
return nil, err
}
app.mintKeeper.InitGenesis(ctx, app.accountKeeper, &minttypes.GenesisState{
BondDenom: "ua0gi",
})
logger.Info("completed store migrations")
// Migration of fractional balances from x/evmutil to x/precisebank
if err := MigrateEvmutilToPrecisebank(
ctx,
app.accountKeeper,
app.bankKeeper,
app.evmutilKeeper,
app.precisebankKeeper,
); err != nil {
return nil, err
}
logger.Info("completed x/evmutil to x/precisebank migration")
return versionMap, nil
}
}
// MigrateEvmutilToPrecisebank migrates all required state from x/evmutil to
// x/precisebank and ensures the resulting state is correct.
// This migrates the following state:
// - Fractional balances
// - Fractional balance reserve
// Initializes the following state in x/precisebank:
// - Remainder amount
func MigrateEvmutilToPrecisebank(
ctx sdk.Context,
accountKeeper evmutiltypes.AccountKeeper,
bankKeeper bankkeeper.Keeper,
evmutilKeeper evmutilkeeper.Keeper,
precisebankKeeper precisebankkeeper.Keeper,
) error {
logger := ctx.Logger()
aggregateSum, err := TransferFractionalBalances(
ctx,
evmutilKeeper,
precisebankKeeper,
)
if err != nil {
return fmt.Errorf("fractional balances transfer: %w", err)
}
logger.Info(
"fractional balances transferred from x/evmutil to x/precisebank",
"aggregate sum", aggregateSum,
)
remainder := InitializeRemainder(ctx, precisebankKeeper, aggregateSum)
logger.Info("remainder amount initialized in x/precisebank", "remainder", remainder)
// Migrate fractional balances, reserve, and ensure reserve fully backs all
// fractional balances.
if err := TransferFractionalBalanceReserve(
ctx,
accountKeeper,
bankKeeper,
precisebankKeeper,
); err != nil {
return fmt.Errorf("reserve transfer: %w", err)
}
return nil
}
// TransferFractionalBalances migrates fractional balances from x/evmutil to
// x/precisebank. It sets the fractional balance in x/precisebank and deletes
// the account from x/evmutil. Returns the aggregate sum of all fractional
// balances.
func TransferFractionalBalances(
ctx sdk.Context,
evmutilKeeper evmutilkeeper.Keeper,
precisebankKeeper precisebankkeeper.Keeper,
) (sdkmath.Int, error) {
aggregateSum := sdkmath.ZeroInt()
var iterErr error
evmutilKeeper.IterateAllAccounts(ctx, func(acc evmutiltypes.Account) bool {
// Set account balance in x/precisebank
precisebankKeeper.SetFractionalBalance(ctx, acc.Address, acc.Balance)
// Delete account from x/evmutil
iterErr := evmutilKeeper.SetAccount(ctx, evmutiltypes.Account{
Address: acc.Address,
// Set balance to 0 to delete it
Balance: sdkmath.ZeroInt(),
})
// Halt iteration if there was an error
if iterErr != nil {
return true
}
// Aggregate sum of all fractional balances
aggregateSum = aggregateSum.Add(acc.Balance)
// Continue iterating
return false
})
return aggregateSum, iterErr
}
// InitializeRemainder initializes the remainder amount in x/precisebank. It
// calculates the remainder amount that is needed to ensure that the sum of all
// fractional balances is a multiple of the conversion factor. The remainder
// amount is stored in the store and returned.
func InitializeRemainder(
ctx sdk.Context,
precisebankKeeper precisebankkeeper.Keeper,
aggregateSum sdkmath.Int,
) sdkmath.Int {
// Extra fractional coins that exceed the conversion factor.
// This extra + remainder should equal the conversion factor to ensure
// (sum(fBalances) + remainder) % conversionFactor = 0
extraFractionalAmount := aggregateSum.Mod(precisebanktypes.ConversionFactor())
remainder := precisebanktypes.ConversionFactor().
Sub(extraFractionalAmount).
// Mod conversion factor to ensure remainder is valid.
// If extraFractionalAmount is a multiple of conversion factor, the
// remainder is 0.
Mod(precisebanktypes.ConversionFactor())
// Panics if the remainder is invalid. In a correct chain state and only
// mint/burns due to transfers, this would be 0.
precisebankKeeper.SetRemainderAmount(ctx, remainder)
return remainder
}
// TransferFractionalBalanceReserve migrates the fractional balance reserve from
// x/evmutil to x/precisebank. It transfers the reserve balance from x/evmutil
// to x/precisebank and ensures that the reserve fully backs all fractional
// balances. It mints or burns coins to back the fractional balances exactly.
func TransferFractionalBalanceReserve(
ctx sdk.Context,
accountKeeper evmutiltypes.AccountKeeper,
bankKeeper bankkeeper.Keeper,
precisebankKeeper precisebankkeeper.Keeper,
) error {
logger := ctx.Logger()
// Transfer x/evmutil reserve to x/precisebank.
evmutilAddr := accountKeeper.GetModuleAddress(evmutiltypes.ModuleName)
reserveBalance := bankKeeper.GetBalance(ctx, evmutilAddr, precisebanktypes.IntegerCoinDenom)
if err := bankKeeper.SendCoinsFromModuleToModule(
ctx,
evmutiltypes.ModuleName, // from x/evmutil
precisebanktypes.ModuleName, // to x/precisebank
sdk.NewCoins(reserveBalance),
); err != nil {
return fmt.Errorf("failed to transfer reserve from x/evmutil to x/precisebank: %w", err)
}
logger.Info(fmt.Sprintf("transferred reserve balance: %s", reserveBalance))
// Ensure x/precisebank reserve fully backs all fractional balances.
totalFractionalBalances := precisebankKeeper.GetTotalSumFractionalBalances(ctx)
// Does NOT ensure state is correct, total fractional balances should be a
// multiple of conversion factor but is not guaranteed due to the remainder.
// Remainder initialization is handled by InitializeRemainder.
// Determine how much the reserve is off by, e.g. unbacked amount
expectedReserveBalance := totalFractionalBalances.Quo(precisebanktypes.ConversionFactor())
// If there is a remainder (totalFractionalBalances % conversionFactor != 0),
// then expectedReserveBalance is rounded up to the nearest integer.
if totalFractionalBalances.Mod(precisebanktypes.ConversionFactor()).IsPositive() {
expectedReserveBalance = expectedReserveBalance.Add(sdkmath.OneInt())
}
unbackedAmount := expectedReserveBalance.Sub(reserveBalance.Amount)
logger.Info(fmt.Sprintf("total account fractional balances: %s", totalFractionalBalances))
// Three possible cases:
// 1. Reserve is not enough, mint coins to back the fractional balances
// 2. Reserve is too much, burn coins to back the fractional balances exactly
// 3. Reserve is exactly enough, no action needed
if unbackedAmount.IsPositive() {
coins := sdk.NewCoins(sdk.NewCoin(precisebanktypes.IntegerCoinDenom, unbackedAmount))
if err := bankKeeper.MintCoins(ctx, precisebanktypes.ModuleName, coins); err != nil {
return fmt.Errorf("failed to mint extra reserve coins: %w", err)
}
logger.Info(fmt.Sprintf("unbacked amount minted to reserve: %s", unbackedAmount))
} else if unbackedAmount.IsNegative() {
coins := sdk.NewCoins(sdk.NewCoin(precisebanktypes.IntegerCoinDenom, unbackedAmount.Neg()))
if err := bankKeeper.BurnCoins(ctx, precisebanktypes.ModuleName, coins); err != nil {
return fmt.Errorf("failed to burn extra reserve coins: %w", err)
}
logger.Info(fmt.Sprintf("extra reserve amount burned: %s", unbackedAmount.Neg()))
} else {
logger.Info("reserve exactly backs fractional balances, no mint/burn needed")
}
return nil
}

View File

@ -2671,7 +2671,7 @@ GenesisState defines the council module's genesis state.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#kava.community.v1beta1.Params) | | params defines all the parameters related to commmunity |
| `params` | [Params](#kava.community.v1beta1.Params) | | params defines all the parameters related to community |
| `staking_rewards_state` | [StakingRewardsState](#kava.community.v1beta1.StakingRewardsState) | | StakingRewardsState stores the internal staking reward data required to track staking rewards across blocks |

6
go.mod
View File

@ -9,6 +9,7 @@ require (
cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015
github.com/Kava-Labs/opendb v0.0.0-20240719173129-a2f11f6d7e51
github.com/cenkalti/backoff/v4 v4.1.3
github.com/cockroachdb/errors v1.11.1
github.com/cometbft/cometbft v0.37.9
github.com/cometbft/cometbft-db v0.9.1
github.com/coniks-sys/coniks-go v0.0.0-20180722014011-11acf4819b71
@ -28,6 +29,7 @@ require (
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/huandu/skiplist v1.2.0
github.com/linxGnu/grocksdb v1.8.13
github.com/pelletier/go-toml/v2 v2.1.0
github.com/shopspring/decimal v1.4.0
@ -76,7 +78,6 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.0 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
@ -146,7 +147,6 @@ require (
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.1 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/iancoleman/orderedmap v0.2.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
@ -242,7 +242,7 @@ replace (
github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db v0.9.1-kava.2
// Use cosmos-sdk fork with backported fix for unsafe-reset-all, staking transfer events, and custom tally handler support
// github.com/cosmos/cosmos-sdk => github.com/0glabs/cosmos-sdk v0.46.11-kava.3
github.com/cosmos/cosmos-sdk => github.com/0glabs/cosmos-sdk v0.47.10-0glabs.9
github.com/cosmos/cosmos-sdk => github.com/0glabs/cosmos-sdk v0.47.10-0glabs.10
github.com/cosmos/iavl => github.com/kava-labs/iavl v1.2.0-kava.1
// See https://github.com/cosmos/cosmos-sdk/pull/13093
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2

6
go.sum
View File

@ -211,8 +211,10 @@ git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFN
git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA=
github.com/0glabs/cometbft v0.37.9-0glabs.1 h1:KQJG17Y21suKP3QNICLto4b5Ak73XbSmKxeLbg0ZM68=
github.com/0glabs/cometbft v0.37.9-0glabs.1/go.mod h1:j0Q3RqrCd+cztWCugs3obbzC4NyHGBPZZjtm/fWV00I=
github.com/0glabs/ethermint v0.21.0-0g.v3.1.8 h1:/jxCtO5B8amXgGZ0MWcoIH32PmoU9Z+WfPxA8nLaZI8=
github.com/0glabs/ethermint v0.21.0-0g.v3.1.8/go.mod h1:1GrxH8zkhO/x8sinIxaFtolK50spzSAZISbdP1MDLy8=
github.com/0glabs/cosmos-sdk v0.47.10-0glabs.10 h1:NJp0RwczHBO4EvrQdDxxftHOgUDBtNh7M/vpaG7wFtQ=
github.com/0glabs/cosmos-sdk v0.47.10-0glabs.10/go.mod h1:KskIVnhXTFqrw7CDccMvx7To5KzUsOomIsQV7sPGOog=
github.com/0glabs/ethermint v0.21.0-0g.v3.1.9 h1:oTHp7tSAqoML7D/+RXsBzA9DsbZ80MX93VJYjR/Akh4=
github.com/0glabs/ethermint v0.21.0-0g.v3.1.9/go.mod h1:6e/gOcDLhvlDWK3JLJVBgki0gD6H4E1eG7l9byocgWA=
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM=

View File

@ -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

View File

@ -67,7 +67,12 @@
},
{
"internalType": "uint256",
"name": "total",
"name": "initialSupply",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "supply",
"type": "uint256"
}
],

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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,
@ -125,6 +127,7 @@ func (s *WrappedA0giBaseTestSuite) TestMinterSupply() {
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{

View File

@ -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(),
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(),
InitialSupply: big.NewInt(4e18).Bytes(),
})
var err error

View File

@ -11,7 +11,8 @@ import (
type Supply = struct {
Cap *big.Int "json:\"cap\""
Total *big.Int "json:\"total\""
InitialSupply *big.Int "json:\"initialSupply\""
Supply *big.Int "json:\"supply\""
}
func NewGetW0GIRequest(args []interface{}) (*types.GetWA0GIRequest, error) {

View File

@ -1,5 +1,5 @@
syntax = "proto3";
package zgc.wrappeda0gibase;
package zgc.wrappeda0gibase.v1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

View File

@ -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;
}

View File

@ -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 {}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -1,7 +1,6 @@
package keeper_test
import (
"fmt"
"math/big"
"testing"
@ -65,6 +64,7 @@ func (s *MsgServerTestSuite) TestSetMinterCap() {
caps []struct {
account common.Address
cap *big.Int
initialSupply *big.Int
}
}{
{
@ -72,34 +72,42 @@ func (s *MsgServerTestSuite) TestSetMinterCap() {
caps: []struct {
account common.Address
cap *big.Int
initialSupply *big.Int
}{
{
account: common.HexToAddress("0x0000000000000000000000000000000000000000"),
cap: big.NewInt(100000),
initialSupply: big.NewInt(50000),
},
{
account: common.HexToAddress("0x0000000000000000000000000000000000000001"),
cap: big.NewInt(200000),
initialSupply: big.NewInt(100000),
},
{
account: common.HexToAddress("0x0000000000000000000000000000000000000002"),
cap: big.NewInt(300000),
initialSupply: big.NewInt(150000),
},
{
account: common.HexToAddress("0x0000000000000000000000000000000000000003"),
cap: big.NewInt(400000),
initialSupply: big.NewInt(200000),
},
{
account: common.HexToAddress("0x0000000000000000000000000000000000000002"),
cap: big.NewInt(500000),
initialSupply: big.NewInt(250000),
},
{
account: common.HexToAddress("0x0000000000000000000000000000000000000001"),
cap: big.NewInt(600000),
initialSupply: big.NewInt(300000),
},
{
account: common.HexToAddress("0x0000000000000000000000000000000000000000"),
cap: big.NewInt(700000),
initialSupply: big.NewInt(350000),
},
},
},
@ -110,6 +118,7 @@ func (s *MsgServerTestSuite) TestSetMinterCap() {
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(),
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")
@ -166,6 +189,7 @@ func (s *MsgServerTestSuite) TestSetMintBurn() {
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
@ -173,6 +197,7 @@ func (s *MsgServerTestSuite) TestSetMintBurn() {
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)
}
}

View File

@ -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, 0xb4, 0x4f, 0xc1, 0x63, 0x31, 0x76, 0x64, 0x44, 0xc9, 0x8b, 0xa0, 0xc4, 0x61, 0xc9, 0xe6,
0xbb, 0xef, 0x93, 0xfc, 0xe9, 0xd2, 0xeb, 0x23, 0x18, 0xf1, 0xd1, 0x2a, 0xef, 0x6d, 0xa5, 0x24,
0x38, 0xad, 0xc8, 0x0a, 0xb0, 0x8d, 0x25, 0x47, 0x85, 0x6f, 0x31, 0x60, 0x76, 0x7e, 0x04, 0x53,
0xcc, 0x94, 0xf5, 0xca, 0x20, 0xd5, 0x48, 0xe5, 0xa8, 0x88, 0x38, 0x44, 0x7f, 0xbd, 0x04, 0x04,
0x8c, 0xfb, 0xe1, 0x35, 0x6d, 0x57, 0x80, 0x08, 0x3b, 0x2b, 0xc6, 0x49, 0xef, 0xdf, 0x85, 0x6a,
0x0e, 0x13, 0xba, 0x9c, 0xa3, 0xe0, 0x6a, 0x4b, 0x41, 0xd5, 0x3e, 0x0a, 0x37, 0x0f, 0xe9, 0xe2,
0x29, 0x26, 0xbd, 0x06, 0x15, 0x6c, 0x26, 0xd3, 0xe5, 0xd4, 0x53, 0x0e, 0x41, 0xa5, 0xaa, 0xaa,
0xd6, 0x12, 0x5d, 0xb0, 0x2b, 0x76, 0xbb, 0x78, 0xc9, 0x26, 0xb6, 0x91, 0xe0, 0x36, 0x91, 0x3c,
0x3e, 0x7f, 0x77, 0x9c, 0x9d, 0x3a, 0xce, 0x7e, 0x3b, 0xce, 0xbe, 0x7a, 0x9e, 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,
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) {

View File

@ -15,7 +15,6 @@ const (
var (
// prefix
MinterCapKeyPrefix = []byte{0x00}
MinterSupplyKeyPrefix = []byte{0x01}
// keys

View File

@ -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, 0x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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,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0xa6, 0xfa, 0xda, 0xd4,
0x7d, 0x78, 0xaf, 0xd9, 0x54, 0xa2, 0x19, 0xaf, 0xcc, 0xea, 0xc9, 0x64, 0xfb, 0x03, 0x59, 0xdb,
0x3d, 0xb2, 0x77, 0x7b, 0x64, 0x7f, 0xdf, 0x23, 0xfb, 0xe3, 0x01, 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 m.Supply != nil {
{
size, err := m.Supply.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
if len(m.Cap) > 0 {
i -= len(m.Cap)
copy(dAtA[i:], m.Cap)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Cap)))
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:

View File

@ -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.

View File

@ -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)
@ -108,13 +108,14 @@ 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"`
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,
0xc8, 0xcd, 0x4c, 0x69, 0x6f, 0x21, 0x17, 0xb8, 0xb9, 0xbb, 0x39, 0xff, 0xf9, 0xcf, 0x77, 0x9a,
0xbf, 0x39, 0xa0, 0xbf, 0x22, 0x01, 0xfc, 0x9d, 0xa2, 0x24, 0xc1, 0x53, 0xe4, 0x90, 0xd0, 0x47,
0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x6a, 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, 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x11, 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:])

View File

@ -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, 0x8f, 0xd5, 0x65, 0x97, 0x2e, 0x35, 0x79, 0x11, 0xc9, 0x4c,
0xba, 0x30, 0xbb, 0x7b, 0xce, 0x77, 0x0e, 0x5c, 0x4e, 0x7c, 0xbb, 0x13, 0x8c, 0xbe, 0x6f, 0x40,
0x6b, 0xfe, 0x0a, 0xb9, 0x90, 0x05, 0x18, 0x4e, 0xb7, 0xcb, 0xb1, 0x95, 0xe9, 0x0d, 0x5a, 0x4c,
0xa6, 0x3b, 0xc1, 0xb2, 0x31, 0xda, 0x2e, 0x17, 0x73, 0x86, 0xa6, 0x42, 0xf3, 0xe2, 0x52, 0xd4,
0x0b, 0x5f, 0x59, 0x9c, 0x09, 0x14, 0xe8, 0xfd, 0xfe, 0x1a, 0xdc, 0x73, 0x81, 0x28, 0x4a, 0x4e,
0x41, 0x4b, 0x0a, 0x4a, 0xa1, 0x05, 0x2b, 0x51, 0x1d, 0x3b, 0xf3, 0x81, 0x3a, 0x55, 0xd4, 0x6f,
0x14, 0x54, 0x33, 0xa0, 0x8b, 0x31, 0xb2, 0xb2, 0xe2, 0xc6, 0x42, 0xa5, 0x7d, 0xe0, 0xea, 0x29,
0x8e, 0x1e, 0x6b, 0xad, 0xcb, 0x26, 0x39, 0x8d, 0x27, 0x0c, 0xf4, 0x2c, 0xbc, 0x0c, 0x6f, 0xfe,
0xaf, 0xfa, 0x33, 0xb9, 0x8e, 0x4f, 0xa4, 0x92, 0x56, 0x42, 0xe9, 0x23, 0xb3, 0x7f, 0x8e, 0xfd,
0x35, 0x93, 0x69, 0x1c, 0x19, 0x8f, 0x27, 0x0e, 0x0f, 0xea, 0x61, 0xb5, 0xff, 0x21, 0xc1, 0xbe,
0x25, 0xe1, 0xa1, 0x25, 0xe1, 0x77, 0x4b, 0xc2, 0xcf, 0x8e, 0x04, 0x87, 0x8e, 0x04, 0x5f, 0x1d,
0x09, 0x9e, 0xef, 0x85, 0xb4, 0xeb, 0xba, 0xc8, 0x18, 0x56, 0x34, 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")
)