mirror of
https://github.com/0glabs/0g-chain.git
synced 2025-01-23 13:36:58 +00:00
feat: wrapped-a0gi-base skeleton
This commit is contained in:
parent
0ff16c798a
commit
aff086bf7b
21
app/app.go
21
app/app.go
@ -111,6 +111,7 @@ import (
|
|||||||
"github.com/0glabs/0g-chain/chaincfg"
|
"github.com/0glabs/0g-chain/chaincfg"
|
||||||
dasignersprecompile "github.com/0glabs/0g-chain/precompiles/dasigners"
|
dasignersprecompile "github.com/0glabs/0g-chain/precompiles/dasigners"
|
||||||
stakingprecompile "github.com/0glabs/0g-chain/precompiles/staking"
|
stakingprecompile "github.com/0glabs/0g-chain/precompiles/staking"
|
||||||
|
wrappeda0gibaseprecompile "github.com/0glabs/0g-chain/precompiles/wrapped-a0gi-base"
|
||||||
|
|
||||||
"github.com/0glabs/0g-chain/x/bep3"
|
"github.com/0glabs/0g-chain/x/bep3"
|
||||||
bep3keeper "github.com/0glabs/0g-chain/x/bep3/keeper"
|
bep3keeper "github.com/0glabs/0g-chain/x/bep3/keeper"
|
||||||
@ -140,6 +141,9 @@ import (
|
|||||||
validatorvesting "github.com/0glabs/0g-chain/x/validator-vesting"
|
validatorvesting "github.com/0glabs/0g-chain/x/validator-vesting"
|
||||||
validatorvestingrest "github.com/0glabs/0g-chain/x/validator-vesting/client/rest"
|
validatorvestingrest "github.com/0glabs/0g-chain/x/validator-vesting/client/rest"
|
||||||
validatorvestingtypes "github.com/0glabs/0g-chain/x/validator-vesting/types"
|
validatorvestingtypes "github.com/0glabs/0g-chain/x/validator-vesting/types"
|
||||||
|
wrappeda0gibase "github.com/0glabs/0g-chain/x/wrapped-a0gi-base"
|
||||||
|
wrappeda0gibasekeeper "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/keeper"
|
||||||
|
wrappeda0gibasetypes "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -187,6 +191,7 @@ var (
|
|||||||
dasigners.AppModuleBasic{},
|
dasigners.AppModuleBasic{},
|
||||||
consensus.AppModuleBasic{},
|
consensus.AppModuleBasic{},
|
||||||
ibcwasm.AppModuleBasic{},
|
ibcwasm.AppModuleBasic{},
|
||||||
|
wrappeda0gibase.AppModuleBasic{},
|
||||||
)
|
)
|
||||||
|
|
||||||
// module account permissions
|
// module account permissions
|
||||||
@ -275,6 +280,7 @@ type App struct {
|
|||||||
dasignersKeeper dasignerskeeper.Keeper
|
dasignersKeeper dasignerskeeper.Keeper
|
||||||
consensusParamsKeeper consensusparamkeeper.Keeper
|
consensusParamsKeeper consensusparamkeeper.Keeper
|
||||||
precisebankKeeper precisebankkeeper.Keeper
|
precisebankKeeper precisebankkeeper.Keeper
|
||||||
|
wrappeda0gibaseKeeper wrappeda0gibasekeeper.Keeper
|
||||||
|
|
||||||
// make scoped keepers public for test purposes
|
// make scoped keepers public for test purposes
|
||||||
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
|
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
|
||||||
@ -327,6 +333,7 @@ func NewApp(
|
|||||||
vestingtypes.StoreKey,
|
vestingtypes.StoreKey,
|
||||||
consensusparamtypes.StoreKey, crisistypes.StoreKey, precisebanktypes.StoreKey,
|
consensusparamtypes.StoreKey, crisistypes.StoreKey, precisebanktypes.StoreKey,
|
||||||
ibcwasmtypes.StoreKey,
|
ibcwasmtypes.StoreKey,
|
||||||
|
wrappeda0gibasetypes.StoreKey,
|
||||||
)
|
)
|
||||||
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
|
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
|
||||||
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
|
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
|
||||||
@ -496,11 +503,10 @@ func NewApp(
|
|||||||
app.accountKeeper,
|
app.accountKeeper,
|
||||||
)
|
)
|
||||||
|
|
||||||
// dasigners keeper
|
|
||||||
app.dasignersKeeper = dasignerskeeper.NewKeeper(keys[dasignerstypes.StoreKey], appCodec, app.stakingKeeper, govAuthAddrStr)
|
|
||||||
// precopmiles
|
// precopmiles
|
||||||
precompiles := make(map[common.Address]vm.PrecompiledContract)
|
precompiles := make(map[common.Address]vm.PrecompiledContract)
|
||||||
// dasigners
|
// dasigners
|
||||||
|
app.dasignersKeeper = dasignerskeeper.NewKeeper(keys[dasignerstypes.StoreKey], appCodec, app.stakingKeeper, govAuthAddrStr)
|
||||||
daSignersPrecompile, err := dasignersprecompile.NewDASignersPrecompile(app.dasignersKeeper)
|
daSignersPrecompile, err := dasignersprecompile.NewDASignersPrecompile(app.dasignersKeeper)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("initialize dasigners precompile failed: %v", err))
|
panic(fmt.Sprintf("initialize dasigners precompile failed: %v", err))
|
||||||
@ -512,6 +518,13 @@ func NewApp(
|
|||||||
panic(fmt.Sprintf("initialize staking precompile failed: %v", err))
|
panic(fmt.Sprintf("initialize staking precompile failed: %v", err))
|
||||||
}
|
}
|
||||||
precompiles[stakingPrecompile.Address()] = stakingPrecompile
|
precompiles[stakingPrecompile.Address()] = stakingPrecompile
|
||||||
|
// wrapped wrapped a0gi base
|
||||||
|
app.wrappeda0gibaseKeeper = wrappeda0gibasekeeper.NewKeeper(keys[wrappeda0gibasetypes.StoreKey], appCodec, govAuthAddrStr)
|
||||||
|
wrappeda0gibasePrecompile, err := wrappeda0gibaseprecompile.NewWrappedA0giBasePrecompile(app.wrappeda0gibaseKeeper)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("initialize wrapped a0gi base precompile failed: %v", err))
|
||||||
|
}
|
||||||
|
precompiles[wrappeda0gibasePrecompile.Address()] = wrappeda0gibasePrecompile
|
||||||
|
|
||||||
app.evmKeeper = evmkeeper.NewKeeper(
|
app.evmKeeper = evmkeeper.NewKeeper(
|
||||||
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey],
|
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey],
|
||||||
@ -695,6 +708,7 @@ func NewApp(
|
|||||||
council.NewAppModule(app.CouncilKeeper),
|
council.NewAppModule(app.CouncilKeeper),
|
||||||
ibcwasm.NewAppModule(app.ibcWasmClientKeeper),
|
ibcwasm.NewAppModule(app.ibcWasmClientKeeper),
|
||||||
dasigners.NewAppModule(app.dasignersKeeper, *app.stakingKeeper),
|
dasigners.NewAppModule(app.dasignersKeeper, *app.stakingKeeper),
|
||||||
|
wrappeda0gibase.NewAppModule(app.wrappeda0gibaseKeeper),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Warning: Some begin blockers must run before others. Ensure the dependencies are understood before modifying this list.
|
// Warning: Some begin blockers must run before others. Ensure the dependencies are understood before modifying this list.
|
||||||
@ -742,6 +756,7 @@ func NewApp(
|
|||||||
precisebanktypes.ModuleName,
|
precisebanktypes.ModuleName,
|
||||||
ibcwasmtypes.ModuleName,
|
ibcwasmtypes.ModuleName,
|
||||||
dasignerstypes.ModuleName,
|
dasignerstypes.ModuleName,
|
||||||
|
wrappeda0gibasetypes.ModuleName,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Warning: Some end blockers must run before others. Ensure the dependencies are understood before modifying this list.
|
// Warning: Some end blockers must run before others. Ensure the dependencies are understood before modifying this list.
|
||||||
@ -779,6 +794,7 @@ func NewApp(
|
|||||||
precisebanktypes.ModuleName,
|
precisebanktypes.ModuleName,
|
||||||
ibcwasmtypes.ModuleName,
|
ibcwasmtypes.ModuleName,
|
||||||
dasignerstypes.ModuleName,
|
dasignerstypes.ModuleName,
|
||||||
|
wrappeda0gibasetypes.ModuleName,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Warning: Some init genesis methods must run before others. Ensure the dependencies are understood before modifying this list
|
// Warning: Some init genesis methods must run before others. Ensure the dependencies are understood before modifying this list
|
||||||
@ -815,6 +831,7 @@ func NewApp(
|
|||||||
crisistypes.ModuleName, // runs the invariants at genesis, should run after other modules
|
crisistypes.ModuleName, // runs the invariants at genesis, should run after other modules
|
||||||
ibcwasmtypes.ModuleName,
|
ibcwasmtypes.ModuleName,
|
||||||
dasignerstypes.ModuleName,
|
dasignerstypes.ModuleName,
|
||||||
|
wrappeda0gibasetypes.ModuleName,
|
||||||
)
|
)
|
||||||
|
|
||||||
app.mm.RegisterInvariants(&app.crisisKeeper)
|
app.mm.RegisterInvariants(&app.crisisKeeper)
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-only
|
// SPDX-License-Identifier: LGPL-3.0-only
|
||||||
pragma solidity >=0.8.0;
|
pragma solidity >=0.8.0;
|
||||||
|
|
||||||
/**
|
|
||||||
* @title WrappedA0GIBase is a precompile for wrapped a0gi(wA0GI), it enables wA0GI mint/burn native 0g token directly.
|
|
||||||
*/
|
|
||||||
interface IWrappedA0GIBase {
|
|
||||||
struct Supply {
|
struct Supply {
|
||||||
uint256 cap;
|
uint256 cap;
|
||||||
uint256 total;
|
uint256 total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title WrappedA0GIBase is a precompile for wrapped a0gi(wA0GI), it enables wA0GI mint/burn native 0g token directly.
|
||||||
|
*/
|
||||||
|
interface IWrappedA0GIBase {
|
||||||
/**
|
/**
|
||||||
* @dev set the wA0GI address.
|
* @dev set the wA0GI address.
|
||||||
* It is designed to be called by governance module only so it's not implemented at EVM precompile side.
|
* It is designed to be called by governance module only so it's not implemented at EVM precompile side.
|
||||||
|
74
precompiles/wrapped-a0gi-base/IWrappedA0GIBase.json
Normal file
74
precompiles/wrapped-a0gi-base/IWrappedA0GIBase.json
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "minter",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "amount",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "burn",
|
||||||
|
"outputs": [],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "minter",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "to",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "amount",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "mint",
|
||||||
|
"outputs": [],
|
||||||
|
"stateMutability": "nonpayable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "minter",
|
||||||
|
"type": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "minterSupply",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "cap",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "total",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Supply",
|
||||||
|
"name": "",
|
||||||
|
"type": "tuple"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
}
|
||||||
|
]
|
253
precompiles/wrapped-a0gi-base/contract.go
Normal file
253
precompiles/wrapped-a0gi-base/contract.go
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
// Code generated - DO NOT EDIT.
|
||||||
|
// This file is a generated binding and any manual changes will be lost.
|
||||||
|
|
||||||
|
package wrappeda0gibase
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"math/big"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
ethereum "github.com/ethereum/go-ethereum"
|
||||||
|
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||||
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/event"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var (
|
||||||
|
_ = errors.New
|
||||||
|
_ = big.NewInt
|
||||||
|
_ = strings.NewReader
|
||||||
|
_ = ethereum.NotFound
|
||||||
|
_ = bind.Bind
|
||||||
|
_ = common.Big1
|
||||||
|
_ = types.BloomLookup
|
||||||
|
_ = event.NewSubscription
|
||||||
|
)
|
||||||
|
|
||||||
|
// Wrappeda0gibaseMetaData contains all meta data concerning the Wrappeda0gibase contract.
|
||||||
|
var Wrappeda0gibaseMetaData = &bind.MetaData{
|
||||||
|
ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"minter\",\"type\":\"address\"}],\"name\":\"minterSupply\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"cap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"internalType\":\"structSupply\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]",
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappeda0gibaseABI is the input ABI used to generate the binding from.
|
||||||
|
// Deprecated: Use Wrappeda0gibaseMetaData.ABI instead.
|
||||||
|
var Wrappeda0gibaseABI = Wrappeda0gibaseMetaData.ABI
|
||||||
|
|
||||||
|
// Wrappeda0gibase is an auto generated Go binding around an Ethereum contract.
|
||||||
|
type Wrappeda0gibase struct {
|
||||||
|
Wrappeda0gibaseCaller // Read-only binding to the contract
|
||||||
|
Wrappeda0gibaseTransactor // Write-only binding to the contract
|
||||||
|
Wrappeda0gibaseFilterer // Log filterer for contract events
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappeda0gibaseCaller is an auto generated read-only Go binding around an Ethereum contract.
|
||||||
|
type Wrappeda0gibaseCaller struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappeda0gibaseTransactor is an auto generated write-only Go binding around an Ethereum contract.
|
||||||
|
type Wrappeda0gibaseTransactor struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappeda0gibaseFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
|
||||||
|
type Wrappeda0gibaseFilterer struct {
|
||||||
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappeda0gibaseSession is an auto generated Go binding around an Ethereum contract,
|
||||||
|
// with pre-set call and transact options.
|
||||||
|
type Wrappeda0gibaseSession struct {
|
||||||
|
Contract *Wrappeda0gibase // Generic contract binding to set the session for
|
||||||
|
CallOpts bind.CallOpts // Call options to use throughout this session
|
||||||
|
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappeda0gibaseCallerSession is an auto generated read-only Go binding around an Ethereum contract,
|
||||||
|
// with pre-set call options.
|
||||||
|
type Wrappeda0gibaseCallerSession struct {
|
||||||
|
Contract *Wrappeda0gibaseCaller // Generic contract caller binding to set the session for
|
||||||
|
CallOpts bind.CallOpts // Call options to use throughout this session
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappeda0gibaseTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
|
||||||
|
// with pre-set transact options.
|
||||||
|
type Wrappeda0gibaseTransactorSession struct {
|
||||||
|
Contract *Wrappeda0gibaseTransactor // Generic contract transactor binding to set the session for
|
||||||
|
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappeda0gibaseRaw is an auto generated low-level Go binding around an Ethereum contract.
|
||||||
|
type Wrappeda0gibaseRaw struct {
|
||||||
|
Contract *Wrappeda0gibase // Generic contract binding to access the raw methods on
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappeda0gibaseCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
|
||||||
|
type Wrappeda0gibaseCallerRaw struct {
|
||||||
|
Contract *Wrappeda0gibaseCaller // Generic read-only contract binding to access the raw methods on
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappeda0gibaseTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
|
||||||
|
type Wrappeda0gibaseTransactorRaw struct {
|
||||||
|
Contract *Wrappeda0gibaseTransactor // Generic write-only contract binding to access the raw methods on
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewWrappeda0gibase creates a new instance of Wrappeda0gibase, bound to a specific deployed contract.
|
||||||
|
func NewWrappeda0gibase(address common.Address, backend bind.ContractBackend) (*Wrappeda0gibase, error) {
|
||||||
|
contract, err := bindWrappeda0gibase(address, backend, backend, backend)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &Wrappeda0gibase{Wrappeda0gibaseCaller: Wrappeda0gibaseCaller{contract: contract}, Wrappeda0gibaseTransactor: Wrappeda0gibaseTransactor{contract: contract}, Wrappeda0gibaseFilterer: Wrappeda0gibaseFilterer{contract: contract}}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewWrappeda0gibaseCaller creates a new read-only instance of Wrappeda0gibase, bound to a specific deployed contract.
|
||||||
|
func NewWrappeda0gibaseCaller(address common.Address, caller bind.ContractCaller) (*Wrappeda0gibaseCaller, error) {
|
||||||
|
contract, err := bindWrappeda0gibase(address, caller, nil, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &Wrappeda0gibaseCaller{contract: contract}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewWrappeda0gibaseTransactor creates a new write-only instance of Wrappeda0gibase, bound to a specific deployed contract.
|
||||||
|
func NewWrappeda0gibaseTransactor(address common.Address, transactor bind.ContractTransactor) (*Wrappeda0gibaseTransactor, error) {
|
||||||
|
contract, err := bindWrappeda0gibase(address, nil, transactor, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &Wrappeda0gibaseTransactor{contract: contract}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewWrappeda0gibaseFilterer creates a new log filterer instance of Wrappeda0gibase, bound to a specific deployed contract.
|
||||||
|
func NewWrappeda0gibaseFilterer(address common.Address, filterer bind.ContractFilterer) (*Wrappeda0gibaseFilterer, error) {
|
||||||
|
contract, err := bindWrappeda0gibase(address, nil, nil, filterer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &Wrappeda0gibaseFilterer{contract: contract}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// bindWrappeda0gibase binds a generic wrapper to an already deployed contract.
|
||||||
|
func bindWrappeda0gibase(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
|
||||||
|
parsed, err := abi.JSON(strings.NewReader(Wrappeda0gibaseABI))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call invokes the (constant) contract method with params as input values and
|
||||||
|
// sets the output to result. The result type might be a single field for simple
|
||||||
|
// returns, a slice of interfaces for anonymous returns and a struct for named
|
||||||
|
// returns.
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
|
||||||
|
return _Wrappeda0gibase.Contract.Wrappeda0gibaseCaller.contract.Call(opts, result, method, params...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||||
|
// its default method if one is available.
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||||
|
return _Wrappeda0gibase.Contract.Wrappeda0gibaseTransactor.contract.Transfer(opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transact invokes the (paid) contract method with params as input values.
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||||
|
return _Wrappeda0gibase.Contract.Wrappeda0gibaseTransactor.contract.Transact(opts, method, params...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call invokes the (constant) contract method with params as input values and
|
||||||
|
// sets the output to result. The result type might be a single field for simple
|
||||||
|
// returns, a slice of interfaces for anonymous returns and a struct for named
|
||||||
|
// returns.
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
|
||||||
|
return _Wrappeda0gibase.Contract.contract.Call(opts, result, method, params...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transfer initiates a plain transaction to move funds to the contract, calling
|
||||||
|
// its default method if one is available.
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||||
|
return _Wrappeda0gibase.Contract.contract.Transfer(opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transact invokes the (paid) contract method with params as input values.
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
||||||
|
return _Wrappeda0gibase.Contract.contract.Transact(opts, method, params...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MinterSupply is a free data retrieval call binding the contract method 0x95609212.
|
||||||
|
//
|
||||||
|
// Solidity: function minterSupply(address minter) view returns((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)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return *new(Supply), err
|
||||||
|
}
|
||||||
|
|
||||||
|
out0 := *abi.ConvertType(out[0], new(Supply)).(*Supply)
|
||||||
|
|
||||||
|
return out0, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MinterSupply is a free data retrieval call binding the contract method 0x95609212.
|
||||||
|
//
|
||||||
|
// Solidity: function minterSupply(address minter) view returns((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))
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseCallerSession) MinterSupply(minter common.Address) (Supply, error) {
|
||||||
|
return _Wrappeda0gibase.Contract.MinterSupply(&_Wrappeda0gibase.CallOpts, minter)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Burn is a paid mutator transaction binding the contract method 0x9dc29fac.
|
||||||
|
//
|
||||||
|
// Solidity: function burn(address minter, uint256 amount) returns()
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseTransactor) Burn(opts *bind.TransactOpts, minter common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||||
|
return _Wrappeda0gibase.contract.Transact(opts, "burn", minter, amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Burn is a paid mutator transaction binding the contract method 0x9dc29fac.
|
||||||
|
//
|
||||||
|
// Solidity: function burn(address minter, uint256 amount) returns()
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseSession) Burn(minter common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||||
|
return _Wrappeda0gibase.Contract.Burn(&_Wrappeda0gibase.TransactOpts, minter, amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Burn is a paid mutator transaction binding the contract method 0x9dc29fac.
|
||||||
|
//
|
||||||
|
// Solidity: function burn(address minter, uint256 amount) returns()
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseTransactorSession) Burn(minter common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||||
|
return _Wrappeda0gibase.Contract.Burn(&_Wrappeda0gibase.TransactOpts, minter, amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mint is a paid mutator transaction binding the contract method 0xc6c3bbe6.
|
||||||
|
//
|
||||||
|
// Solidity: function mint(address minter, address to, uint256 amount) returns()
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseTransactor) Mint(opts *bind.TransactOpts, minter common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||||
|
return _Wrappeda0gibase.contract.Transact(opts, "mint", minter, to, amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mint is a paid mutator transaction binding the contract method 0xc6c3bbe6.
|
||||||
|
//
|
||||||
|
// Solidity: function mint(address minter, address to, uint256 amount) returns()
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseSession) Mint(minter common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||||
|
return _Wrappeda0gibase.Contract.Mint(&_Wrappeda0gibase.TransactOpts, minter, to, amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mint is a paid mutator transaction binding the contract method 0xc6c3bbe6.
|
||||||
|
//
|
||||||
|
// Solidity: function mint(address minter, address to, uint256 amount) returns()
|
||||||
|
func (_Wrappeda0gibase *Wrappeda0gibaseTransactorSession) Mint(minter common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) {
|
||||||
|
return _Wrappeda0gibase.Contract.Mint(&_Wrappeda0gibase.TransactOpts, minter, to, amount)
|
||||||
|
}
|
8
precompiles/wrapped-a0gi-base/types.go
Normal file
8
precompiles/wrapped-a0gi-base/types.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package wrappeda0gibase
|
||||||
|
|
||||||
|
import "math/big"
|
||||||
|
|
||||||
|
type Supply = struct {
|
||||||
|
Cap *big.Int "json:\"cap\""
|
||||||
|
Total *big.Int "json:\"total\""
|
||||||
|
}
|
65
precompiles/wrapped-a0gi-base/wrapped_a0gi_base.go
Normal file
65
precompiles/wrapped-a0gi-base/wrapped_a0gi_base.go
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package wrappeda0gibase
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
precompiles_common "github.com/0glabs/0g-chain/precompiles/common"
|
||||||
|
wrappeda0gibasekeeper "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/keeper"
|
||||||
|
"github.com/cosmos/cosmos-sdk/store/types"
|
||||||
|
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
PrecompileAddress = "0x0000000000000000000000000000000000001002"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ vm.PrecompiledContract = &WrappedA0giBasePrecompile{}
|
||||||
|
var _ precompiles_common.PrecompileCommon = &WrappedA0giBasePrecompile{}
|
||||||
|
|
||||||
|
type WrappedA0giBasePrecompile struct {
|
||||||
|
abi abi.ABI
|
||||||
|
wrappeda0gibaseKeeper wrappeda0gibasekeeper.Keeper
|
||||||
|
}
|
||||||
|
|
||||||
|
// Abi implements common.PrecompileCommon.
|
||||||
|
func (w *WrappedA0giBasePrecompile) Abi() *abi.ABI {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsTx implements common.PrecompileCommon.
|
||||||
|
func (w *WrappedA0giBasePrecompile) IsTx(string) bool {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
// KVGasConfig implements common.PrecompileCommon.
|
||||||
|
func (w *WrappedA0giBasePrecompile) KVGasConfig() types.GasConfig {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Address implements vm.PrecompiledContract.
|
||||||
|
func (w *WrappedA0giBasePrecompile) Address() common.Address {
|
||||||
|
return common.HexToAddress(PrecompileAddress)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RequiredGas implements vm.PrecompiledContract.
|
||||||
|
func (w *WrappedA0giBasePrecompile) RequiredGas(input []byte) uint64 {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWrappedA0giBasePrecompile(wrappeda0gibaseKeeper wrappeda0gibasekeeper.Keeper) (*WrappedA0giBasePrecompile, error) {
|
||||||
|
abi, err := abi.JSON(strings.NewReader(Wrappeda0gibaseABI))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &WrappedA0giBasePrecompile{
|
||||||
|
abi: abi,
|
||||||
|
wrappeda0gibaseKeeper: wrappeda0gibaseKeeper,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run implements vm.PrecompiledContract.
|
||||||
|
func (w *WrappedA0giBasePrecompile) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
15
proto/zgc/wrappeda0gibase/genesis.proto
Normal file
15
proto/zgc/wrappeda0gibase/genesis.proto
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
package zgc.wrappeda0gibase;
|
||||||
|
|
||||||
|
import "cosmos_proto/cosmos.proto";
|
||||||
|
import "gogoproto/gogo.proto";
|
||||||
|
import "google/protobuf/any.proto";
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
|
|
||||||
|
option go_package = "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types";
|
||||||
|
|
||||||
|
// GenesisState defines the wrapped a0gi base module's genesis state.
|
||||||
|
message GenesisState {
|
||||||
|
// address of wrapped a0gi contract
|
||||||
|
string wrapped_a0gi_address = 1;
|
||||||
|
}
|
27
proto/zgc/wrappeda0gibase/query.proto
Normal file
27
proto/zgc/wrappeda0gibase/query.proto
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
package zgc.wrappeda0gibase;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// Query defines the gRPC querier service for the wrapped a0gi base module
|
||||||
|
service Query {
|
||||||
|
rpc MinterSupply(MinterSupplyRequest) returns (MinterSupplyResponse) {
|
||||||
|
option (google.api.http).get = "/0g/wrapped-a0gi-base/minter-supply";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message MinterSupplyRequest {
|
||||||
|
string address = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MinterSupplyResponse {
|
||||||
|
string cap = 1;
|
||||||
|
string supply = 2;
|
||||||
|
}
|
47
proto/zgc/wrappeda0gibase/tx.proto
Normal file
47
proto/zgc/wrappeda0gibase/tx.proto
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
package zgc.wrappeda0gibase;
|
||||||
|
|
||||||
|
import "cosmos_proto/cosmos.proto";
|
||||||
|
import "gogoproto/gogo.proto";
|
||||||
|
import "google/protobuf/any.proto";
|
||||||
|
|
||||||
|
option go_package = "github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types";
|
||||||
|
option (gogoproto.goproto_getters_all) = false;
|
||||||
|
|
||||||
|
// Msg defines the wrapped a0gi base Msg service
|
||||||
|
service Msg {
|
||||||
|
rpc SetWA0GI(MsgSetWA0GI) returns (MsgSetWA0GIResponse);
|
||||||
|
rpc SetMinterCap(MsgSetMintCap) returns (MsgSetMintCapResponse);
|
||||||
|
rpc Mint(MsgMint) returns (MsgMintResponse);
|
||||||
|
rpc Burn(MsgBurn) returns (MsgBurnResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgSetWA0GI {
|
||||||
|
string authority = 1;
|
||||||
|
string address = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgSetWA0GIResponse {}
|
||||||
|
|
||||||
|
message MsgSetMintCap {
|
||||||
|
string authority = 1;
|
||||||
|
string minter = 2;
|
||||||
|
string cap = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgSetMintCapResponse {}
|
||||||
|
|
||||||
|
message MsgMint {
|
||||||
|
string minter = 1;
|
||||||
|
string to = 2;
|
||||||
|
string amount = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgMintResponse {}
|
||||||
|
|
||||||
|
message MsgBurn {
|
||||||
|
string minter = 1;
|
||||||
|
string amount = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MsgBurnResponse {}
|
23
x/wrapped-a0gi-base/cli/query.go
Normal file
23
x/wrapped-a0gi-base/cli/query.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetQueryCmd returns the cli query commands for the inflation module.
|
||||||
|
func GetQueryCmd() *cobra.Command {
|
||||||
|
cmd := &cobra.Command{
|
||||||
|
Use: types.ModuleName,
|
||||||
|
Short: "Querying commands for the dasigners module",
|
||||||
|
DisableFlagParsing: true,
|
||||||
|
SuggestionsMinimumDistance: 2,
|
||||||
|
RunE: client.ValidateCmd,
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.AddCommand()
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
}
|
22
x/wrapped-a0gi-base/cli/tx.go
Normal file
22
x/wrapped-a0gi-base/cli/tx.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetTxCmd returns the transaction commands for this module
|
||||||
|
func GetTxCmd() *cobra.Command {
|
||||||
|
cmd := &cobra.Command{
|
||||||
|
Use: types.ModuleName,
|
||||||
|
Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName),
|
||||||
|
DisableFlagParsing: true,
|
||||||
|
SuggestionsMinimumDistance: 2,
|
||||||
|
RunE: client.ValidateCmd,
|
||||||
|
}
|
||||||
|
cmd.AddCommand()
|
||||||
|
return cmd
|
||||||
|
}
|
22
x/wrapped-a0gi-base/genesis.go
Normal file
22
x/wrapped-a0gi-base/genesis.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package wrappeda0gibase
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/keeper"
|
||||||
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InitGenesis initializes the store state from a genesis state.
|
||||||
|
func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, gs types.GenesisState) {
|
||||||
|
if err := gs.Validate(); err != nil {
|
||||||
|
panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err))
|
||||||
|
}
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportGenesis returns a GenesisState for a given context and keeper.
|
||||||
|
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
8
x/wrapped-a0gi-base/keeper/abci.go
Normal file
8
x/wrapped-a0gi-base/keeper/abci.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package keeper
|
||||||
|
|
||||||
|
import (
|
||||||
|
abci "github.com/cometbft/cometbft/abci/types"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (k Keeper) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {}
|
14
x/wrapped-a0gi-base/keeper/grpc_query.go
Normal file
14
x/wrapped-a0gi-base/keeper/grpc_query.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package keeper
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ types.QueryServer = Keeper{}
|
||||||
|
|
||||||
|
// MinterSupply implements types.QueryServer.
|
||||||
|
func (k Keeper) MinterSupply(c context.Context, request *types.MinterSupplyRequest) (*types.MinterSupplyResponse, error) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
26
x/wrapped-a0gi-base/keeper/keeper.go
Normal file
26
x/wrapped-a0gi-base/keeper/keeper.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package keeper
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
|
||||||
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Keeper struct {
|
||||||
|
storeKey storetypes.StoreKey
|
||||||
|
cdc codec.BinaryCodec
|
||||||
|
authority string // the address capable of changing signers params. Should be the gov module account
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewKeeper creates a new wrapped a0gi base keeper instance
|
||||||
|
func NewKeeper(
|
||||||
|
storeKey storetypes.StoreKey,
|
||||||
|
cdc codec.BinaryCodec,
|
||||||
|
authority string,
|
||||||
|
) Keeper {
|
||||||
|
return Keeper{
|
||||||
|
storeKey: storeKey,
|
||||||
|
cdc: cdc,
|
||||||
|
authority: authority,
|
||||||
|
}
|
||||||
|
}
|
38
x/wrapped-a0gi-base/keeper/msg_server.go
Normal file
38
x/wrapped-a0gi-base/keeper/msg_server.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package keeper
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
errorsmod "cosmossdk.io/errors"
|
||||||
|
"github.com/0glabs/0g-chain/crypto/bn254util"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
gov "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
etherminttypes "github.com/evmos/ethermint/types"
|
||||||
|
*/
|
||||||
|
|
||||||
|
var _ types.MsgServer = &Keeper{}
|
||||||
|
|
||||||
|
// Burn implements types.MsgServer.
|
||||||
|
func (k Keeper) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.MsgBurnResponse, error) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mint implements types.MsgServer.
|
||||||
|
func (k Keeper) Mint(goCtx context.Context, msg *types.MsgMint) (*types.MsgMintResponse, error) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetMinterCap implements types.MsgServer.
|
||||||
|
func (k Keeper) SetMinterCap(goCtx context.Context, msg *types.MsgSetMintCap) (*types.MsgSetMintCapResponse, error) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetWA0GI implements types.MsgServer.
|
||||||
|
func (k Keeper) SetWA0GI(goCtx context.Context, msg *types.MsgSetWA0GI) (*types.MsgSetWA0GIResponse, error) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
168
x/wrapped-a0gi-base/module.go
Normal file
168
x/wrapped-a0gi-base/module.go
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
package wrappeda0gibase
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/cli"
|
||||||
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/keeper"
|
||||||
|
"github.com/0glabs/0g-chain/x/wrapped-a0gi-base/types"
|
||||||
|
abci "github.com/cometbft/cometbft/abci/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/types/module"
|
||||||
|
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||||
|
"github.com/gorilla/mux"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
// consensusVersion defines the current x/council module consensus version.
|
||||||
|
const consensusVersion = 1
|
||||||
|
|
||||||
|
// type check to ensure the interface is properly implemented
|
||||||
|
var (
|
||||||
|
_ module.AppModule = AppModule{}
|
||||||
|
_ module.AppModuleBasic = AppModuleBasic{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// app module Basics object
|
||||||
|
type AppModuleBasic struct{}
|
||||||
|
|
||||||
|
// Name returns the inflation module's name.
|
||||||
|
func (AppModuleBasic) Name() string {
|
||||||
|
return types.ModuleName
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterLegacyAminoCodec registers the inflation module's types on the given LegacyAmino codec.
|
||||||
|
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}
|
||||||
|
|
||||||
|
// ConsensusVersion returns the consensus state-breaking version for the module.
|
||||||
|
func (AppModuleBasic) ConsensusVersion() uint64 {
|
||||||
|
return consensusVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterInterfaces registers interfaces and implementations of the incentives
|
||||||
|
// module.
|
||||||
|
func (AppModuleBasic) RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry) {
|
||||||
|
types.RegisterInterfaces(interfaceRegistry)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultGenesis returns default genesis state as raw bytes for the incentives
|
||||||
|
// module.
|
||||||
|
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
|
||||||
|
return cdc.MustMarshalJSON(types.DefaultGenesisState())
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateGenesis performs genesis state validation for the inflation module.
|
||||||
|
func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
|
||||||
|
var genesisState types.GenesisState
|
||||||
|
if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil {
|
||||||
|
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return genesisState.Validate()
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterRESTRoutes performs a no-op as the inflation module doesn't expose REST
|
||||||
|
// endpoints
|
||||||
|
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {}
|
||||||
|
|
||||||
|
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the inflation module.
|
||||||
|
func (b AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *runtime.ServeMux) {
|
||||||
|
if err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(c)); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTxCmd returns the root tx command for the inflation module.
|
||||||
|
func (AppModuleBasic) GetTxCmd() *cobra.Command {
|
||||||
|
return cli.GetTxCmd()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetQueryCmd returns no root query command for the inflation module.
|
||||||
|
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
|
||||||
|
return cli.GetQueryCmd()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ___________________________________________________________________________
|
||||||
|
|
||||||
|
// AppModule implements an application module for the inflation module.
|
||||||
|
type AppModule struct {
|
||||||
|
AppModuleBasic
|
||||||
|
keeper keeper.Keeper
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAppModule creates a new AppModule Object
|
||||||
|
func NewAppModule(
|
||||||
|
k keeper.Keeper,
|
||||||
|
) AppModule {
|
||||||
|
return AppModule{
|
||||||
|
AppModuleBasic: AppModuleBasic{},
|
||||||
|
keeper: k,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Name returns the inflation module's name.
|
||||||
|
func (AppModule) Name() string {
|
||||||
|
return types.ModuleName
|
||||||
|
}
|
||||||
|
|
||||||
|
// QuerierRoute returns wrapped a0gi base module's query routing key.
|
||||||
|
func (AppModule) QuerierRoute() string { return types.QuerierRoute }
|
||||||
|
|
||||||
|
// RegisterInvariants registers the inflation module invariants.
|
||||||
|
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||||
|
|
||||||
|
// RegisterServices registers a gRPC query service to respond to the
|
||||||
|
// module-specific gRPC queries.
|
||||||
|
func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||||
|
types.RegisterMsgServer(cfg.MsgServer(), am.keeper)
|
||||||
|
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
|
||||||
|
am.keeper.BeginBlock(ctx, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {
|
||||||
|
// am.keeper.EndBlock(ctx, req)
|
||||||
|
return []abci.ValidatorUpdate{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitGenesis performs genesis initialization for the inflation module. It returns
|
||||||
|
// no validator updates.
|
||||||
|
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate {
|
||||||
|
var genesisState types.GenesisState
|
||||||
|
|
||||||
|
cdc.MustUnmarshalJSON(data, &genesisState)
|
||||||
|
InitGenesis(ctx, am.keeper, genesisState)
|
||||||
|
return []abci.ValidatorUpdate{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportGenesis returns the exported genesis state as raw bytes for the inflation
|
||||||
|
// module.
|
||||||
|
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
|
||||||
|
gs := ExportGenesis(ctx, am.keeper)
|
||||||
|
return cdc.MustMarshalJSON(gs)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ___________________________________________________________________________
|
||||||
|
|
||||||
|
// AppModuleSimulation functions
|
||||||
|
|
||||||
|
// GenerateGenesisState creates a randomized GenState of the inflation module.
|
||||||
|
func (am AppModule) GenerateGenesisState(_ *module.SimulationState) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterStoreDecoder registers a decoder for inflation module's types.
|
||||||
|
func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// WeightedOperations doesn't return any inflation module operation.
|
||||||
|
func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation {
|
||||||
|
return []simtypes.WeightedOperation{}
|
||||||
|
}
|
45
x/wrapped-a0gi-base/types/codec.go
Normal file
45
x/wrapped-a0gi-base/types/codec.go
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/types/msgservice"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
amino = codec.NewLegacyAmino()
|
||||||
|
// ModuleCdc references the global evm module codec. Note, the codec should
|
||||||
|
// ONLY be used in certain instances of tests and for JSON encoding.
|
||||||
|
ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
|
||||||
|
|
||||||
|
// AminoCdc is a amino codec created to support amino JSON compatible msgs.
|
||||||
|
AminoCdc = codec.NewAminoCodec(amino)
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Amino names
|
||||||
|
)
|
||||||
|
|
||||||
|
// NOTE: This is required for the GetSignBytes function
|
||||||
|
func init() {
|
||||||
|
RegisterLegacyAminoCodec(amino)
|
||||||
|
amino.Seal()
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterInterfaces register implementations
|
||||||
|
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||||
|
registry.RegisterImplementations(
|
||||||
|
(*sdk.Msg)(nil),
|
||||||
|
&MsgSetWA0GI{},
|
||||||
|
&MsgSetMintCap{},
|
||||||
|
&MsgMint{},
|
||||||
|
&MsgBurn{},
|
||||||
|
)
|
||||||
|
|
||||||
|
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterLegacyAminoCodec required for EIP-712
|
||||||
|
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||||
|
}
|
7
x/wrapped-a0gi-base/types/errors.go
Normal file
7
x/wrapped-a0gi-base/types/errors.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
import errorsmod "cosmossdk.io/errors"
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrTxForbidden = errorsmod.Register(ModuleName, 1, "cosmos tx forbidden")
|
||||||
|
)
|
18
x/wrapped-a0gi-base/types/genesis.go
Normal file
18
x/wrapped-a0gi-base/types/genesis.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
// NewGenesisState returns a new genesis state object for the module.
|
||||||
|
func NewGenesisState(addr string) *GenesisState {
|
||||||
|
return &GenesisState{
|
||||||
|
WrappedA0GiAddress: addr,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultGenesisState returns the default genesis state for the module.
|
||||||
|
func DefaultGenesisState() *GenesisState {
|
||||||
|
return NewGenesisState("0000000000000000000000000000000000000000")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate performs basic validation of genesis data.
|
||||||
|
func (gs GenesisState) Validate() error {
|
||||||
|
return ValidateHexAddress(gs.WrappedA0GiAddress)
|
||||||
|
}
|
326
x/wrapped-a0gi-base/types/genesis.pb.go
Normal file
326
x/wrapped-a0gi-base/types/genesis.pb.go
Normal file
@ -0,0 +1,326 @@
|
|||||||
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||||
|
// source: zgc/wrappeda0gibase/genesis.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/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
|
||||||
|
|
||||||
|
// GenesisState defines the wrapped a0gi base module's genesis state.
|
||||||
|
type GenesisState struct {
|
||||||
|
// address of wrapped a0gi contract
|
||||||
|
WrappedA0GiAddress string `protobuf:"bytes,1,opt,name=wrapped_a0gi_address,json=wrappedA0giAddress,proto3" json:"wrapped_a0gi_address,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
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}
|
||||||
|
}
|
||||||
|
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
|
||||||
|
} else {
|
||||||
|
b = b[:cap(b)]
|
||||||
|
n, err := m.MarshalToSizedBuffer(b)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return b[:n], nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (m *GenesisState) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GenesisState.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *GenesisState) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *GenesisState) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GenesisState.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GenesisState) GetWrappedA0GiAddress() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.WrappedA0GiAddress
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*GenesisState)(nil), "zgc.wrappeda0gibase.GenesisState")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("zgc/wrappeda0gibase/genesis.proto", fileDescriptor_7e056019f61fd820) }
|
||||||
|
|
||||||
|
var fileDescriptor_7e056019f61fd820 = []byte{
|
||||||
|
// 246 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xbd, 0x4e, 0xc3, 0x30,
|
||||||
|
0x10, 0x80, 0xe3, 0x05, 0x89, 0x88, 0x29, 0x74, 0xa0, 0x1d, 0xcc, 0xcf, 0xc4, 0x92, 0xd8, 0x12,
|
||||||
|
0x3c, 0x00, 0x65, 0x61, 0x63, 0x80, 0x8d, 0x25, 0xb2, 0x1d, 0x73, 0xb5, 0xd4, 0xe4, 0xac, 0x9c,
|
||||||
|
0x2b, 0x68, 0x9f, 0x82, 0xc7, 0x62, 0xec, 0xc8, 0x88, 0x92, 0x17, 0x41, 0x89, 0xc3, 0x92, 0xcd,
|
||||||
|
0x77, 0xdf, 0x27, 0xf9, 0xd3, 0xa5, 0xd7, 0x07, 0x30, 0xe2, 0xa3, 0x55, 0xde, 0xdb, 0x4a, 0x49,
|
||||||
|
0x70, 0x5a, 0x91, 0x15, 0x60, 0x1b, 0x4b, 0x8e, 0x0a, 0xdf, 0x62, 0xc0, 0xec, 0xfc, 0x00, 0xa6,
|
||||||
|
0x98, 0x29, 0xab, 0xa5, 0x41, 0xaa, 0x91, 0xca, 0x51, 0x11, 0x71, 0x88, 0xfe, 0x6a, 0x01, 0x08,
|
||||||
|
0x18, 0xf7, 0xc3, 0x6b, 0xda, 0x2e, 0x01, 0x11, 0xb6, 0x56, 0x8c, 0x93, 0xde, 0xbd, 0x0b, 0xd5,
|
||||||
|
0xec, 0x27, 0x74, 0x39, 0x47, 0xc1, 0xd5, 0x96, 0x82, 0xaa, 0x7d, 0x14, 0x6e, 0x1e, 0xd2, 0xb3,
|
||||||
|
0xa7, 0x98, 0xf4, 0x1a, 0x54, 0xb0, 0x99, 0x4c, 0x17, 0x53, 0x4f, 0x39, 0x04, 0x95, 0xaa, 0xaa,
|
||||||
|
0x5a, 0x4b, 0x74, 0xc1, 0xae, 0xd8, 0xed, 0xe9, 0x4b, 0x36, 0xb1, 0xb5, 0x04, 0xb7, 0x8e, 0xe4,
|
||||||
|
0xf1, 0xf9, 0xbb, 0xe3, 0xec, 0xd8, 0x71, 0xf6, 0xdb, 0x71, 0xf6, 0xd5, 0xf3, 0xe4, 0xd8, 0xf3,
|
||||||
|
0xe4, 0xa7, 0xe7, 0xc9, 0xdb, 0x3d, 0xb8, 0xb0, 0xd9, 0xe9, 0xc2, 0x60, 0x2d, 0x24, 0x6c, 0x95,
|
||||||
|
0x26, 0x21, 0x21, 0x37, 0x1b, 0xe5, 0x1a, 0xf1, 0xf9, 0x7f, 0x99, 0x7c, 0xf8, 0x26, 0x1f, 0x6f,
|
||||||
|
0x13, 0xf6, 0xde, 0x92, 0x3e, 0x19, 0xc3, 0xee, 0xfe, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe8, 0xe8,
|
||||||
|
0x6b, 0x2a, 0x3f, 0x01, 0x00, 0x00,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.WrappedA0GiAddress) > 0 {
|
||||||
|
i -= len(m.WrappedA0GiAddress)
|
||||||
|
copy(dAtA[i:], m.WrappedA0GiAddress)
|
||||||
|
i = encodeVarintGenesis(dAtA, i, uint64(len(m.WrappedA0GiAddress)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
|
||||||
|
offset -= sovGenesis(v)
|
||||||
|
base := offset
|
||||||
|
for v >= 1<<7 {
|
||||||
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||||
|
v >>= 7
|
||||||
|
offset++
|
||||||
|
}
|
||||||
|
dAtA[offset] = uint8(v)
|
||||||
|
return base
|
||||||
|
}
|
||||||
|
func (m *GenesisState) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.WrappedA0GiAddress)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func sovGenesis(x uint64) (n int) {
|
||||||
|
return (math_bits.Len64(x|1) + 6) / 7
|
||||||
|
}
|
||||||
|
func sozGenesis(x uint64) (n int) {
|
||||||
|
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||||
|
}
|
||||||
|
func (m *GenesisState) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenesis
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field WrappedA0GiAddress", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenesis
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.WrappedA0GiAddress = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func skipGenesis(dAtA []byte) (n int, err error) {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
depth := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowGenesis
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
switch wireType {
|
||||||
|
case 0:
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowGenesis
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx++
|
||||||
|
if dAtA[iNdEx-1] < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
iNdEx += 8
|
||||||
|
case 2:
|
||||||
|
var length int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowGenesis
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
length |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if length < 0 {
|
||||||
|
return 0, ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
iNdEx += length
|
||||||
|
case 3:
|
||||||
|
depth++
|
||||||
|
case 4:
|
||||||
|
if depth == 0 {
|
||||||
|
return 0, ErrUnexpectedEndOfGroupGenesis
|
||||||
|
}
|
||||||
|
depth--
|
||||||
|
case 5:
|
||||||
|
iNdEx += 4
|
||||||
|
default:
|
||||||
|
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||||
|
}
|
||||||
|
if iNdEx < 0 {
|
||||||
|
return 0, ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
if depth == 0 {
|
||||||
|
return iNdEx, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||||
|
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
|
||||||
|
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
|
||||||
|
)
|
12
x/wrapped-a0gi-base/types/keys.go
Normal file
12
x/wrapped-a0gi-base/types/keys.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ModuleName The name that will be used throughout the module
|
||||||
|
ModuleName = "wrapped-a0gi-base"
|
||||||
|
|
||||||
|
// StoreKey Top level store key where all module items will be stored
|
||||||
|
StoreKey = ModuleName
|
||||||
|
|
||||||
|
// QuerierRoute Top level query string
|
||||||
|
QuerierRoute = ModuleName
|
||||||
|
)
|
92
x/wrapped-a0gi-base/types/msg.go
Normal file
92
x/wrapped-a0gi-base/types/msg.go
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/hex"
|
||||||
|
fmt "fmt"
|
||||||
|
|
||||||
|
errorsmod "cosmossdk.io/errors"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _, _, _, _ sdk.Msg = &MsgSetWA0GI{}, &MsgSetMintCap{}, &MsgMint{}, &MsgBurn{}
|
||||||
|
|
||||||
|
func ValidateHexAddress(account string) error {
|
||||||
|
addr, err := hex.DecodeString(account)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(addr) != 20 {
|
||||||
|
return fmt.Errorf("invalid address length")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgSetWA0GI) GetSigners() []sdk.AccAddress {
|
||||||
|
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
|
||||||
|
return []sdk.AccAddress{addr}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgSetWA0GI) ValidateBasic() error {
|
||||||
|
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
|
||||||
|
return errorsmod.Wrap(err, "authority")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ValidateHexAddress(msg.Address); err != nil {
|
||||||
|
return errorsmod.Wrap(err, "address")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg MsgSetWA0GI) GetSignBytes() []byte {
|
||||||
|
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgSetMintCap) GetSigners() []sdk.AccAddress {
|
||||||
|
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
|
||||||
|
return []sdk.AccAddress{addr}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgSetMintCap) ValidateBasic() error {
|
||||||
|
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
|
||||||
|
return errorsmod.Wrap(err, "authority")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ValidateHexAddress(msg.Minter); err != nil {
|
||||||
|
return errorsmod.Wrap(err, "minter")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg MsgSetMintCap) GetSignBytes() []byte {
|
||||||
|
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgMint) GetSigners() []sdk.AccAddress {
|
||||||
|
return []sdk.AccAddress{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgMint) ValidateBasic() error {
|
||||||
|
// forbid mint from cosmos tx
|
||||||
|
// it can only be called by wrapped a0gi from EVM
|
||||||
|
return ErrTxForbidden
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg MsgMint) GetSignBytes() []byte {
|
||||||
|
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgBurn) GetSigners() []sdk.AccAddress {
|
||||||
|
return []sdk.AccAddress{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgBurn) ValidateBasic() error {
|
||||||
|
// forbid burn from cosmos tx
|
||||||
|
// it can only be called by wrapped a0gi from EVM
|
||||||
|
return ErrTxForbidden
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg MsgBurn) GetSignBytes() []byte {
|
||||||
|
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
|
||||||
|
}
|
616
x/wrapped-a0gi-base/types/query.pb.go
Normal file
616
x/wrapped-a0gi-base/types/query.pb.go
Normal file
@ -0,0 +1,616 @@
|
|||||||
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||||
|
// source: zgc/wrappeda0gibase/query.proto
|
||||||
|
|
||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
fmt "fmt"
|
||||||
|
_ "github.com/cosmos/cosmos-proto"
|
||||||
|
_ "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
|
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||||
|
grpc1 "github.com/cosmos/gogoproto/grpc"
|
||||||
|
proto "github.com/cosmos/gogoproto/proto"
|
||||||
|
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
_ "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 MinterSupplyRequest struct {
|
||||||
|
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MinterSupplyRequest) Reset() { *m = MinterSupplyRequest{} }
|
||||||
|
func (m *MinterSupplyRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*MinterSupplyRequest) ProtoMessage() {}
|
||||||
|
func (*MinterSupplyRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_19911faa2ec12c75, []int{0}
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_MinterSupplyRequest.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 *MinterSupplyRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_MinterSupplyRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyRequest) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_MinterSupplyRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_MinterSupplyRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
type MinterSupplyResponse struct {
|
||||||
|
Cap string `protobuf:"bytes,1,opt,name=cap,proto3" json:"cap,omitempty"`
|
||||||
|
Supply string `protobuf:"bytes,2,opt,name=supply,proto3" json:"supply,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MinterSupplyResponse) Reset() { *m = MinterSupplyResponse{} }
|
||||||
|
func (m *MinterSupplyResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*MinterSupplyResponse) ProtoMessage() {}
|
||||||
|
func (*MinterSupplyResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_19911faa2ec12c75, []int{1}
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_MinterSupplyResponse.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 *MinterSupplyResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_MinterSupplyResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyResponse) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_MinterSupplyResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_MinterSupplyResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*MinterSupplyRequest)(nil), "zgc.wrappeda0gibase.MinterSupplyRequest")
|
||||||
|
proto.RegisterType((*MinterSupplyResponse)(nil), "zgc.wrappeda0gibase.MinterSupplyResponse")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("zgc/wrappeda0gibase/query.proto", fileDescriptor_19911faa2ec12c75) }
|
||||||
|
|
||||||
|
var fileDescriptor_19911faa2ec12c75 = []byte{
|
||||||
|
// 348 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xc1, 0x4a, 0x2b, 0x31,
|
||||||
|
0x14, 0x86, 0x27, 0xbd, 0xdc, 0x5e, 0x6e, 0x70, 0x21, 0x69, 0x91, 0x76, 0x90, 0x54, 0x2a, 0x42,
|
||||||
|
0x45, 0x66, 0x32, 0xa8, 0x0f, 0x20, 0xee, 0x5d, 0x58, 0x77, 0x6e, 0x24, 0x33, 0x8d, 0x69, 0xa0,
|
||||||
|
0x93, 0xa4, 0x93, 0x0c, 0xda, 0x2e, 0x7d, 0x82, 0x82, 0x3b, 0x9f, 0xa8, 0xcb, 0x82, 0x1b, 0x97,
|
||||||
|
0xda, 0xfa, 0x20, 0x32, 0x99, 0x29, 0x68, 0xe9, 0xc2, 0x5d, 0xfe, 0x73, 0xbe, 0xff, 0xe4, 0xf0,
|
||||||
|
0x1f, 0xd8, 0x99, 0xf2, 0x84, 0x3c, 0x64, 0x54, 0x6b, 0x36, 0xa0, 0x11, 0x17, 0x31, 0x35, 0x8c,
|
||||||
|
0x8c, 0x73, 0x96, 0x4d, 0x42, 0x9d, 0x29, 0xab, 0x50, 0x63, 0xca, 0x93, 0x70, 0x03, 0xf0, 0xdb,
|
||||||
|
0x89, 0x32, 0xa9, 0x32, 0x77, 0x0e, 0x21, 0xa5, 0x28, 0x79, 0xbf, 0xc9, 0x15, 0x57, 0x65, 0xbd,
|
||||||
|
0x78, 0x55, 0xd5, 0x7d, 0xae, 0x14, 0x1f, 0x31, 0x42, 0xb5, 0x20, 0x54, 0x4a, 0x65, 0xa9, 0x15,
|
||||||
|
0x4a, 0xae, 0x3d, 0xed, 0xaa, 0xeb, 0x54, 0x9c, 0xdf, 0x13, 0x2a, 0xab, 0xef, 0xfd, 0xce, 0x66,
|
||||||
|
0xcb, 0x8a, 0x94, 0x19, 0x4b, 0x53, 0x5d, 0x02, 0x5d, 0x02, 0x1b, 0x57, 0x42, 0x5a, 0x96, 0xdd,
|
||||||
|
0xe4, 0x5a, 0x8f, 0x26, 0x7d, 0x36, 0xce, 0x99, 0xb1, 0xa8, 0x05, 0xff, 0xd1, 0xc1, 0x20, 0x63,
|
||||||
|
0xc6, 0xb4, 0xc0, 0x01, 0xe8, 0xfd, 0xef, 0xaf, 0x65, 0xf7, 0x02, 0x36, 0x7f, 0x1a, 0x8c, 0x56,
|
||||||
|
0xd2, 0x30, 0xb4, 0x0b, 0xff, 0x24, 0x54, 0x57, 0x74, 0xf1, 0x44, 0x7b, 0xb0, 0x6e, 0x1c, 0xd3,
|
||||||
|
0xaa, 0xb9, 0x62, 0xa5, 0x4e, 0x5f, 0x00, 0xfc, 0x7b, 0x5d, 0x44, 0x84, 0x66, 0x00, 0xee, 0x7c,
|
||||||
|
0x1f, 0x86, 0x7a, 0xe1, 0x96, 0xb8, 0xc2, 0x2d, 0x0b, 0xfa, 0xc7, 0xbf, 0x20, 0xcb, 0xcd, 0xba,
|
||||||
|
0x27, 0x4f, 0xaf, 0x9f, 0xcf, 0xb5, 0x23, 0x74, 0x48, 0x22, 0xbe, 0xbe, 0x55, 0x50, 0x58, 0x02,
|
||||||
|
0x77, 0xad, 0xd4, 0x79, 0x82, 0x72, 0xb9, 0xcb, 0xfe, 0xfc, 0x03, 0x7b, 0xf3, 0x25, 0x06, 0x8b,
|
||||||
|
0x25, 0x06, 0xef, 0x4b, 0x0c, 0x66, 0x2b, 0xec, 0x2d, 0x56, 0xd8, 0x7b, 0x5b, 0x61, 0xef, 0xf6,
|
||||||
|
0x9c, 0x0b, 0x3b, 0xcc, 0xe3, 0x30, 0x51, 0x29, 0x89, 0xf8, 0x88, 0xc6, 0x86, 0x44, 0x3c, 0x48,
|
||||||
|
0x86, 0x54, 0x48, 0xf2, 0xb8, 0x65, 0xb6, 0x9d, 0x68, 0x66, 0xe2, 0xba, 0x8b, 0xfa, 0xec, 0x2b,
|
||||||
|
0x00, 0x00, 0xff, 0xff, 0x26, 0x34, 0x94, 0xac, 0x2d, 0x02, 0x00, 0x00,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ context.Context
|
||||||
|
var _ grpc.ClientConn
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
const _ = grpc.SupportPackageIsVersion4
|
||||||
|
|
||||||
|
// QueryClient is the client API for Query service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||||
|
type QueryClient interface {
|
||||||
|
MinterSupply(ctx context.Context, in *MinterSupplyRequest, opts ...grpc.CallOption) (*MinterSupplyResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type queryClient struct {
|
||||||
|
cc grpc1.ClientConn
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewQueryClient(cc grpc1.ClientConn) QueryClient {
|
||||||
|
return &queryClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
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...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryServer is the server API for Query service.
|
||||||
|
type QueryServer interface {
|
||||||
|
MinterSupply(context.Context, *MinterSupplyRequest) (*MinterSupplyResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedQueryServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UnimplementedQueryServer) MinterSupply(ctx context.Context, req *MinterSupplyRequest) (*MinterSupplyResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method MinterSupply not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
|
||||||
|
s.RegisterService(&_Query_serviceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Query_MinterSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(MinterSupplyRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(QueryServer).MinterSupply(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/zgc.wrappeda0gibase.Query/MinterSupply",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(QueryServer).MinterSupply(ctx, req.(*MinterSupplyRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _Query_serviceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "zgc.wrappeda0gibase.Query",
|
||||||
|
HandlerType: (*QueryServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "MinterSupply",
|
||||||
|
Handler: _Query_MinterSupply_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "zgc/wrappeda0gibase/query.proto",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MinterSupplyRequest) 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 *MinterSupplyRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MinterSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Address) > 0 {
|
||||||
|
i -= len(m.Address)
|
||||||
|
copy(dAtA[i:], m.Address)
|
||||||
|
i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MinterSupplyResponse) 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 *MinterSupplyResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MinterSupplyResponse) 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 = 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)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
|
||||||
|
offset -= sovQuery(v)
|
||||||
|
base := offset
|
||||||
|
for v >= 1<<7 {
|
||||||
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||||
|
v >>= 7
|
||||||
|
offset++
|
||||||
|
}
|
||||||
|
dAtA[offset] = uint8(v)
|
||||||
|
return base
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyRequest) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.Address)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovQuery(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MinterSupplyResponse) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.Cap)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovQuery(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Supply)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovQuery(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func sovQuery(x uint64) (n int) {
|
||||||
|
return (math_bits.Len64(x|1) + 6) / 7
|
||||||
|
}
|
||||||
|
func sozQuery(x uint64) (n int) {
|
||||||
|
return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyRequest) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: MinterSupplyRequest: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: MinterSupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Address = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *MinterSupplyResponse) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: MinterSupplyResponse: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: MinterSupplyResponse: 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 stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Cap = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Supply", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Supply = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func skipQuery(dAtA []byte) (n int, err error) {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
depth := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
switch wireType {
|
||||||
|
case 0:
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx++
|
||||||
|
if dAtA[iNdEx-1] < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
iNdEx += 8
|
||||||
|
case 2:
|
||||||
|
var length int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
length |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if length < 0 {
|
||||||
|
return 0, ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
iNdEx += length
|
||||||
|
case 3:
|
||||||
|
depth++
|
||||||
|
case 4:
|
||||||
|
if depth == 0 {
|
||||||
|
return 0, ErrUnexpectedEndOfGroupQuery
|
||||||
|
}
|
||||||
|
depth--
|
||||||
|
case 5:
|
||||||
|
iNdEx += 4
|
||||||
|
default:
|
||||||
|
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||||
|
}
|
||||||
|
if iNdEx < 0 {
|
||||||
|
return 0, ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
if depth == 0 {
|
||||||
|
return iNdEx, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||||
|
ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow")
|
||||||
|
ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
|
||||||
|
)
|
171
x/wrapped-a0gi-base/types/query.pb.gw.go
Normal file
171
x/wrapped-a0gi-base/types/query.pb.gw.go
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||||
|
// source: zgc/wrappeda0gibase/query.proto
|
||||||
|
|
||||||
|
/*
|
||||||
|
Package types is a reverse proxy.
|
||||||
|
|
||||||
|
It translates gRPC into RESTful JSON APIs.
|
||||||
|
*/
|
||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/descriptor"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
|
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
|
"google.golang.org/grpc/metadata"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Suppress "imported and not used" errors
|
||||||
|
var _ codes.Code
|
||||||
|
var _ io.Reader
|
||||||
|
var _ status.Status
|
||||||
|
var _ = runtime.String
|
||||||
|
var _ = utilities.NewDoubleArray
|
||||||
|
var _ = descriptor.ForMessage
|
||||||
|
var _ = metadata.Join
|
||||||
|
|
||||||
|
var (
|
||||||
|
filter_Query_MinterSupply_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||||
|
)
|
||||||
|
|
||||||
|
func request_Query_MinterSupply_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq MinterSupplyRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
if err := req.ParseForm(); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_MinterSupply_0); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := client.MinterSupply(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_Query_MinterSupply_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq MinterSupplyRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
if err := req.ParseForm(); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_MinterSupply_0); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := server.MinterSupply(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
|
||||||
|
// UnaryRPC :call QueryServer directly.
|
||||||
|
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||||
|
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
|
||||||
|
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_Query_MinterSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_Query_MinterSupply_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_Query_MinterSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but
|
||||||
|
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||||
|
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||||
|
conn, err := grpc.Dial(endpoint, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if err != nil {
|
||||||
|
if cerr := conn.Close(); cerr != nil {
|
||||||
|
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
if cerr := conn.Close(); cerr != nil {
|
||||||
|
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}()
|
||||||
|
|
||||||
|
return RegisterQueryHandler(ctx, mux, conn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterQueryHandler registers the http handlers for service Query to "mux".
|
||||||
|
// The handlers forward requests to the grpc endpoint over "conn".
|
||||||
|
func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||||
|
return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterQueryHandlerClient registers the http handlers for service Query
|
||||||
|
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient".
|
||||||
|
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient"
|
||||||
|
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||||
|
// "QueryClient" to call the correct interceptors.
|
||||||
|
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_Query_MinterSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_Query_MinterSupply_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_Query_MinterSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
pattern_Query_MinterSupply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"0g", "wrapped-a0gi-base", "minter-supply"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
forward_Query_MinterSupply_0 = runtime.ForwardResponseMessage
|
||||||
|
)
|
1750
x/wrapped-a0gi-base/types/tx.pb.go
Normal file
1750
x/wrapped-a0gi-base/types/tx.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user