Documentation ¶
Index ¶
- Constants
- Variables
- func ContractToDenomKey(contract []byte) []byte
- func DenomToAutoContractKey(denom string) []byte
- func DenomToExternalContractKey(denom string) []byte
- func ErrRegisteredContract(contract string) sdk.EnvelopedErr
- func IsValidIBCDenom(denom string) bool
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- type CompiledContract
- type GenesisState
- type Params
- type TokenMapping
- type TokenMappingProposal
- func (tp TokenMappingProposal) GetDescription() string
- func (tp TokenMappingProposal) GetTitle() string
- func (tp TokenMappingProposal) ProposalRoute() string
- func (tp TokenMappingProposal) ProposalType() string
- func (tp TokenMappingProposal) String() string
- func (tp TokenMappingProposal) ValidateBasic() sdk.Error
Constants ¶
const ( IbcEvmModuleName = "ibc-evm" ContractMintMethod = "mint_by_okc_module" )
const ( // ModuleName string name of module ModuleName = "erc20" // StoreKey key for ethereum storage data, account code (StateDB) or block // related data for Web3. // The erc20 module should use a prefix store. StoreKey = ModuleName // RouterKey uses module name for routing RouterKey = ModuleName QueryParameters = "params" QueryAllMapping = "all-mapping" )
const ( // DefaultParamspace for params keeper DefaultParamspace = ModuleName DefaultIbcTimeout = uint64(86400000000000) // 1 day DefaultAutoDeploymentEnabled = false )
const (
DefaultCodespace string = ModuleName
)
const (
TokenMappingProposalName = "okexchain/erc20/TokenMappingProposal"
)
Variables ¶
var ( EVMModuleETHAddr common.Address EVMModuleBechAddr sdk.AccAddress // ModuleERC20Contract is the compiled okc erc20 contract ModuleERC20Contract CompiledContract )
var ( // ErrChainConfigNotFound returns an error if the chain config cannot be found on the store. ErrChainConfigNotFound = sdkerrors.Register(ModuleName, 1, "chain configuration not found") // ErrKeyNotFound returns an error if the target key not found in database. ErrKeyNotFound = sdkerrors.Register(ModuleName, 2, "Key not found in database") // ErrUnexpectedProposalType returns an error when the proposal type is not supported in erc20 module ErrUnexpectedProposalType = sdkerrors.Register(ModuleName, 3, "Unsupported proposal type of erc20 module") // ErrEmptyAddressList returns an error if the address list is empty ErrEmptyAddressList = sdkerrors.Register(ModuleName, 4, "Empty account address list") ErrIbcDenomInvalid = sdkerrors.Register(ModuleName, 5, "ibc denom is invalid") )
var ( KeyPrefixContractToDenom = []byte{0x01} KeyPrefixDenomToExternalContract = []byte{0x02} KeyPrefixDenoToAutoContract = []byte{0x03} )
KVStore key prefixes
var ( KeyEnableAutoDeployment = []byte("EnableAutoDeployment") KeyIbcTimeout = []byte("IbcTimeout") )
var ModuleCdc = codec.New()
ModuleCdc defines the erc20 module's codec
Functions ¶
func ContractToDenomKey ¶
ContractToDenomKey defines the store key for contract to denom reverse index
func DenomToAutoContractKey ¶
DenomToAutoContractKey defines the store key for denom to auto contract mapping
func DenomToExternalContractKey ¶
DenomToExternalContractKey defines the store key for denom to external contract mapping
func ErrRegisteredContract ¶
func ErrRegisteredContract(contract string) sdk.EnvelopedErr
func IsValidIBCDenom ¶
IsValidIBCDenom returns if denom is a valid ibc denom
func ParamKeyTable ¶
ParamKeyTable returns the parameter key table.
func RegisterCodec ¶
RegisterCodec registers all the necessary types and interfaces for the erc20 module
Types ¶
type CompiledContract ¶
CompiledContract contains compiled bytecode and abi
type GenesisState ¶
type GenesisState struct { Params Params `json:"params"` ExternalContracts []TokenMapping `json:"external_contracts"` AutoContracts []TokenMapping `json:"auto_contracts"` }
GenesisState defines the erc20 module genesis state
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState sets default erc20 genesis state with empty accounts and default params and chain config values.
func (GenesisState) Validate ¶
func (gs GenesisState) Validate() error
Validate performs basic genesis state validation returning an error upon any failure.
type Params ¶
type Params struct { EnableAutoDeployment bool `json:"enable_auto_deployment" yaml:"enable_auto_deployment"` IbcTimeout uint64 `json:"ibc_timeout" yaml:"ibc_timeout"` }
Params defines the module parameters
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs returns the parameter set pairs.
type TokenMapping ¶
TokenMapping defines a mapping between native denom and contract
type TokenMappingProposal ¶
type TokenMappingProposal struct { Title string `json:"title" yaml:"title"` Description string `json:"description" yaml:"description"` Denom string `json:"denom" yaml:"denom"` Contract string `json:"contract" yaml:"contract"` }
func NewTokenMappingProposal ¶
func NewTokenMappingProposal(title, description, denom string, contractAddr *common.Address) TokenMappingProposal
func (TokenMappingProposal) GetDescription ¶
func (tp TokenMappingProposal) GetDescription() string
func (TokenMappingProposal) GetTitle ¶
func (tp TokenMappingProposal) GetTitle() string
func (TokenMappingProposal) ProposalRoute ¶
func (tp TokenMappingProposal) ProposalRoute() string
func (TokenMappingProposal) ProposalType ¶
func (tp TokenMappingProposal) ProposalType() string
func (TokenMappingProposal) String ¶
func (tp TokenMappingProposal) String() string
func (TokenMappingProposal) ValidateBasic ¶
func (tp TokenMappingProposal) ValidateBasic() sdk.Error