Skip to content

Contract

Abstract

This module is responsible for transactions and queries related to evm

Contents

  1. Concepts
  2. Keeper
  3. Messages
chat/
β”œβ”€β”€ client
β”‚ └── rest
β”‚ β”œβ”€β”€ error.go # interface error collection
β”‚ β”œβ”€β”€ grpc.go # grpc query method
β”‚ β”œβ”€β”€ handle_comm.go # comm module message pre-processing
β”‚ β”œβ”€β”€ query.go # interface query function
β”‚ β”œβ”€β”€ rest.go # Registration of message and query routing
β”‚ └── tx.go # tx related methods, including broadcasting, etc.
β”œβ”€β”€keeper
β”‚ β”œβ”€β”€ genesis.go # Status and export of modules
β”‚ β”œβ”€β”€ keeper.go # storage manager, handles the business logic of the module, and has permission to access specific subtrees of the state tree
β”‚ β”œβ”€β”€ msg_server.go # Provide service processing logic for uplink messages
β”‚ β”œβ”€β”€ params.go # Setting and obtaining module parameters
β”‚ β”œβ”€β”€ query.go # Status query function
β”‚ β”œβ”€β”€ medal.go # Hash coin pledge calculation related logic algorithm
β”‚ └── mingkeeper.go # Foundry related logic algorithm
β”œβ”€β”€ types
β”‚ β”œβ”€β”€ codec.go # code registration type
β”‚ β”œβ”€β”€ errors.go # module-specific errors
β”‚ β”œβ”€β”€ events.go # Events exposed to Tendermint PubSub/Websocket
β”‚ β”œβ”€β”€ genesis.go # Genesis state of the module
β”‚ β”œβ”€β”€ interface.go # interface collection of modules
β”‚ β”œβ”€β”€ keys.go # module stores key and some other constants
β”‚ β”œβ”€β”€ msg.go # Chat module transaction message
β”‚ β”œβ”€β”€ params.go # The custom parameters that the module can modify through the governance module
β”‚ β”œβ”€β”€ interface.go # The method implemented by the imported external module
β”‚ └── types.go # module type collection
β”œβ”€β”€ genesis.go # ABCI's genesis state initialization and export function
β”œβ”€β”€ handler.go # message routing
└── module.go # Module settings of the module manager

Overview

Contract

 Contract is responsible for the content related to the evm contract

One-click coin issuance

 Users can directly publish their own tokens on evm through messages, only need to upload some basic information of tokens, no need to deploy token contracts
 Everything is done automatically inside the contract

Cross-chain transfer

 This module can be used to realize the token mapping transfer (such as ETH) from DaoDst to the external chain, and the cross-chain supports two-way

 When DaoDst transfers funds to the external chain, the balance inside DaoDst will be frozen, and at the same time, the external chain contract will issue corresponding tokens
 Correspondingly, when the opposite operation is performed, the external chain is destroyed and Daodst is unfrozen

Keeper

The contract module 'Keeper' grants access to the state of the chat module And implement 'statedb. Interface to support 'StateDB' implementation. Keeper contains a storage key that allows the repository Write to the concrete subtree of the multibase that can only be accessed by the Chat module. Instead of using trees and databases for querying and persistence (the 'StateDB' implementation), DaoDst uses Cosmos' "KVStore" (key-value store) and Cosmos SDK's "Keeper" to facilitate state transitions.

In order to support the interface function, it imports 7 module Keepers:

  • auth: addition, deletion, modification and query of accounts
  • bank: addition, deletion, modification and query of supply and balance
  • staking: management of gateway related data
  • pledge: management of chat related data
  • evm: management of evm related data
  • chat: management of chat related data
  • gateway: gateway data management
    type Keeper struct {
        storeKey   sdk.StoreKey
        cdc        codec.BinaryCodec
        paramstore paramtypes.Subspace

        stakingKeeper *stakingKeeper.Keeper
        accountKeeper types.AccountKeeper
        BankKeeper    types.BankKeeper
        pledgeKeeper  types.PledgeKeeper
        evmKeeper     types.EVMKeeper
        chatKeeper    types.ChatKeeper
        gatewayKeeper types.GatewayKeeper
        erc20Keeper   erc20keeper.Keeper
    }

Messages

MsgAppTokenIssue

Through this message, initiate one-click coin issuance
    type MsgAppTokenIssue struct {
        FromAddress   string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"`
        Name          string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty" yaml:"name"`
        Symbol        string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty" yaml:"symbol"`
        PreMintAmount string `protobuf:"bytes,4,opt,name=pre_mint_amount,json=preMintAmount,proto3" json:"pre_mint_amount,omitempty" yaml:"pre_mint_amount"`
        Decimals      string `protobuf:"bytes,5,opt,name=decimals,proto3" json:"decimals,omitempty" yaml:"decimals"`
        LogoUrl       string `protobuf:"bytes,6,opt,name=logo_url,json=logoUrl,proto3" json:"logo_url,omitempty" yaml:"logo_url"`
    }

MsgCrossChainOut

Through this message, initiate a cross-chain transfer from DaoDst
    type MsgCrossChainOut struct {
        SendAddress string `protobuf:"bytes,1,opt,name=send_address,json=sendAddress,proto3" json:"send_address,omitempty" yaml:"send_address"`
        ToAddress   string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"`
        Coins       string `protobuf:"bytes,3,opt,name=coins,proto3" json:"coins,omitempty" yaml:"coins"`
        ChainType   string `protobuf:"bytes,4,opt,name=chain_type,json=chainType,proto3" json:"chain_type,omitempty" yaml:"chain_type"`
        Remark      string `protobuf:"bytes,5,opt,name=remark,proto3" json:"remark,omitempty" yaml:"remark"`
    }

MsgCrossChainIn

Through this message, a cross-chain transfer to DaoDst is initiated from the external chain

    type MsgCrossChainIn struct {
        SendAddress string `protobuf:"bytes,1,opt,name=send_address,json=sendAddress,proto3" json:"send_address,omitempty" yaml:"send_address"`
        Coins       string `protobuf:"bytes,2,opt,name=coins,proto3" json:"coins,omitempty" yaml:"coins"`
        ChainType   string `protobuf:"bytes,3,opt,name=chain_type,json=chainType,proto3" json:"chain_type,omitempty" yaml:"chain_type"`
        Remark      string `protobuf:"bytes,4,opt,name=remark,proto3" json:"remark,omitempty" yaml:"remark"`
        TxHash      string `protobuf:"bytes,5,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"tx_hash"`
    }