Documentation ¶
Index ¶
- Constants
- Variables
- func ConstructContractKey(str string) []byte
- func ContractToDenomKey(contract []byte) []byte
- func DenomToContractKey(denom string) []byte
- func ErrProxyContractRedirect(denom string, tp int, addr string) sdk.EnvelopedErr
- func ErrRegisteredContract(contract string) sdk.EnvelopedErr
- func GetInternalImplementationBytes() []byte
- func GetInternalProxyBytes() []byte
- func IsValidIBCDenom(denom string) bool
- func MarshalCompileContract(data CompiledContract) ([]byte, error)
- func MustMarshalCompileContract(data CompiledContract) []byte
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- type CompiledContract
- type ContractByDenomRequest
- type ContractTemplate
- type ContractTemplateProposal
- func (b ContractTemplateProposal) GetDescription() string
- func (b ContractTemplateProposal) GetTitle() string
- func (b ContractTemplateProposal) ProposalRoute() string
- func (b ContractTemplateProposal) ProposalType() string
- func (b ContractTemplateProposal) String() string
- func (b ContractTemplateProposal) ValidateBasic() sdk.Error
- type DenomByContractRequest
- type GenesisState
- type Params
- type ProxyContractRedirectProposal
- func (tp ProxyContractRedirectProposal) GetDescription() string
- func (tp ProxyContractRedirectProposal) GetTitle() string
- func (tp ProxyContractRedirectProposal) ProposalRoute() string
- func (tp ProxyContractRedirectProposal) ProposalType() string
- func (tp ProxyContractRedirectProposal) String() string
- func (tp ProxyContractRedirectProposal) ValidateBasic() sdk.Error
- type QueryTokenMappingResponse
- type RedirectType
- 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 ( TokenMappingProposalName = "okexchain/erc20/TokenMappingProposal" ProxyContractRedirectProposalName = "okexchain/erc20/ProxyContractRedirectProposal" ContractTemplateProposalName = "okexchain/erc20/ContractTemplateProposal" CompiledContractProposalName = "okexchain/erc20/Contract" )
const ( IbcEvmModuleName = "ibc-evm" ContractMintMethod = "mint_by_okc_module" ProxyContractUpgradeTo = "upgradeTo" ProxyContractChangeAdmin = "changeAdmin" )
const ( EventTypDeployModuleERC20 = "deploy_erc20_contract" EventTypCallModuleERC20 = "call_erc20_contract" EventTypLock = "erc20_lock" EventTypBurn = "erc20_burn" AttributeKeyContractAddr = "contract_address" AttributeKeyContractMethod = "contract_method" AttributeKeyFrom = "from" AttributeKeyTo = "to" InnerTxUnlock = "erc20-unlock" InnerTxMint = "erc20-mint" InnerTxSendToIbc = "erc20-send-to-ibc" )
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" QueryTokenMapping = "token-mapping" QueryContractByDenom = "contract-by-denom" QueryDenomByContract = "denom-by-contract" QueryContractTem = "current-template-contract" )
const ( // DefaultParamspace for params keeper DefaultParamspace = ModuleName DefaultIbcTimeout = uint64(86400000000000) // 1 day DefaultAutoDeploymentEnabled = false )
const ( ProposalTypeContextTemplateProxy = "proxy" ProposalTypeContextTemplateImpl = "implement" )
const ( RedirectImplementation = iota RedirectOwner )
const (
DefaultCodespace string = ModuleName
)
const (
IbcDenomPrefix = "ibc/"
)
Variables ¶
var ( IbcEvmModuleETHAddr common.Address IbcEvmModuleBechAddr 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(DefaultCodespace, 1, "chain configuration not found") // ErrKeyNotFound returns an error if the target key not found in database. ErrKeyNotFound = sdkerrors.Register(DefaultCodespace, 2, "Key not found in database") // ErrUnexpectedProposalType returns an error when the proposal type is not supported in erc20 module ErrUnexpectedProposalType = sdkerrors.Register(DefaultCodespace, 3, "Unsupported proposal type of erc20 module") // ErrEmptyAddressList returns an error if the address list is empty ErrEmptyAddressList = sdkerrors.Register(DefaultCodespace, 4, "Empty account address list") ErrIbcDenomInvalid = sdkerrors.Register(DefaultCodespace, 5, "ibc denom is invalid") ErrNoContractDeployed = sdkerrors.Register(DefaultCodespace, 6, "no contract deployed") ErrNoContractNotAuto = errors.New("no contract found and not auto deploy for the denom ") )
var ( KeyPrefixContractToDenom = []byte{0x01} KeyPrefixDenomToContract = []byte{0x02} KeyPrefixTemplateContract = []byte{0x03} )
KVStore key prefixes
var ( KeyEnableAutoDeployment = []byte("EnableAutoDeployment") KeyIbcTimeout = []byte("IbcTimeout") )
var ModuleCdc = codec.New()
ModuleCdc defines the erc20 module's codec
var RedirectMap = map[RedirectType]string{ RedirectImplementation: "ImplementationAddr", RedirectOwner: "OwnerAddr", }
Functions ¶
func ConstructContractKey ¶ added in v1.5.4
func ContractToDenomKey ¶
ContractToDenomKey defines the store key for contract to denom reverse index
func DenomToContractKey ¶ added in v1.5.4
DenomToContractKey defines the store key for denom to contract mapping
func ErrProxyContractRedirect ¶ added in v1.5.4
func ErrProxyContractRedirect(denom string, tp int, addr string) sdk.EnvelopedErr
func ErrRegisteredContract ¶
func ErrRegisteredContract(contract string) sdk.EnvelopedErr
func GetInternalImplementationBytes ¶ added in v1.5.4
func GetInternalImplementationBytes() []byte
func GetInternalProxyBytes ¶ added in v1.5.4
func GetInternalProxyBytes() []byte
func IsValidIBCDenom ¶
IsValidIBCDenom returns if denom is a valid ibc denom
func MarshalCompileContract ¶ added in v1.5.4
func MarshalCompileContract(data CompiledContract) ([]byte, error)
func MustMarshalCompileContract ¶ added in v1.5.4
func MustMarshalCompileContract(data CompiledContract) []byte
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
func MustUnmarshalCompileContract ¶ added in v1.5.4
func MustUnmarshalCompileContract(data []byte) CompiledContract
func UnmarshalCompileContract ¶ added in v1.5.4
func UnmarshalCompileContract(data []byte) (CompiledContract, error)
func (CompiledContract) ValidBasic ¶ added in v1.5.4
func (c CompiledContract) ValidBasic() error
type ContractByDenomRequest ¶ added in v1.5.2
type ContractByDenomRequest struct {
Denom string `json:"denom,omitempty"`
}
type ContractTemplate ¶ added in v1.5.4
type ContractTemplateProposal ¶ added in v1.5.4
type ContractTemplateProposal struct { Title string `json:"title" yaml:"title"` Description string `json:"description" yaml:"description"` ContractType string `json:"contract_type"` Contract string `json:"contract"` }
func NewContractTemplateProposal ¶ added in v1.5.4
func NewContractTemplateProposal(title string, description string, contractType string, contract string) ContractTemplateProposal
func (ContractTemplateProposal) GetDescription ¶ added in v1.5.4
func (b ContractTemplateProposal) GetDescription() string
func (ContractTemplateProposal) GetTitle ¶ added in v1.5.4
func (b ContractTemplateProposal) GetTitle() string
func (ContractTemplateProposal) ProposalRoute ¶ added in v1.5.4
func (b ContractTemplateProposal) ProposalRoute() string
func (ContractTemplateProposal) ProposalType ¶ added in v1.5.4
func (b ContractTemplateProposal) ProposalType() string
func (ContractTemplateProposal) String ¶ added in v1.5.4
func (b ContractTemplateProposal) String() string
func (ContractTemplateProposal) ValidateBasic ¶ added in v1.5.4
func (b ContractTemplateProposal) ValidateBasic() sdk.Error
type DenomByContractRequest ¶ added in v1.5.2
type DenomByContractRequest struct {
Contract string `json:"contract,omitempty"`
}
type GenesisState ¶
type GenesisState struct { Params Params `json:"params"` TokenMappings []TokenMapping `json:"token_mappings"` }
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 ProxyContractRedirectProposal ¶ added in v1.5.4
type ProxyContractRedirectProposal struct { Title string `json:"title" yaml:"title"` Description string `json:"description" yaml:"description"` Denom string `json:"denom" yaml:"denom"` Tp RedirectType `json:"type" yaml:"type"` Addr string `json:"addr" yaml:"addr"` }
func NewProxyContractRedirectProposal ¶ added in v1.5.4
func NewProxyContractRedirectProposal(title, description, denom string, tp RedirectType, addr *common.Address) ProxyContractRedirectProposal
func (ProxyContractRedirectProposal) GetDescription ¶ added in v1.5.4
func (tp ProxyContractRedirectProposal) GetDescription() string
func (ProxyContractRedirectProposal) GetTitle ¶ added in v1.5.4
func (tp ProxyContractRedirectProposal) GetTitle() string
func (ProxyContractRedirectProposal) ProposalRoute ¶ added in v1.5.4
func (tp ProxyContractRedirectProposal) ProposalRoute() string
func (ProxyContractRedirectProposal) ProposalType ¶ added in v1.5.4
func (tp ProxyContractRedirectProposal) ProposalType() string
func (ProxyContractRedirectProposal) String ¶ added in v1.5.4
func (tp ProxyContractRedirectProposal) String() string
func (ProxyContractRedirectProposal) ValidateBasic ¶ added in v1.5.4
func (tp ProxyContractRedirectProposal) ValidateBasic() sdk.Error
type QueryTokenMappingResponse ¶ added in v1.6.2
type RedirectType ¶ added in v1.5.4
type RedirectType int
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