erc20

module
v0.0.0-...-c573acc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2022 License: Apache-2.0

README

ERC20 Contract

Each of the modules is in the modules directory.
These contract modules are developed based on Cosmos SDK. Note that these modules depend on version v0.43.0-beta1 for now. See go.mod.

Each of modules needs to meet specific Interfaces.

_ module.AppModule             = AppModule{}
_ module.AppModuleBasic        = AppModuleBasic{}
_ contracttypes.ContractModule = AppModule{}

Refer to source code

See section Introduction to SDK Modules to know Cosmos SDK Modules in detail.

Erc20mgr module

This module has ERC20 functionalities based on CDT according to EIP-20: Token Standard.

Functionalities based on CDT
  1. Mint(account string, amount int64)
  • create amount tokens and assigns them to account, increasing the total supply
  1. Burn(account string, amount int64)
  • destroy amount tokens from account, reducing the total supply
  1. Transfer(spender, recipient string, amount int64)
  • move amount of tokens from sender to recipient
  1. Approve(owner string, spender string, amount int64)
  • approve sets amount as the allowance of spender over the caller's tokens
  1. TransferFrom(owner string, spender string, recipient string, amount int64)
  • move amount tokens from sender to recipient using the allowance mechanism. amount is then deducted from the caller's allowance
  1. Allowance(owner string, spender string)
  • return the remaining number of tokens that spender will be allowed to spend on behalf of owner through transferFrom. This is zero by default.
  1. BalanceOf(account string)
  • return the amount of tokens owned by account
  1. TotalSupply()
  • return the amount of tokens in existence
Handler and process flow

This module includes handler.go

  1. Message MsgContractCallTx is submitted from CLI.
  2. NewHandler() is called from Route() in module.go
  3. handleContractCallTx() in NewHandler() is called
  4. HandleContractCall() in keepr.go is called
  5. Then it calls function according to request method

Erc20contract module

This module is a Contract Module of Cross Framework called from Contract Manager.

Functionalities
  1. Transfer
  • call Transfer of erc20mgr contract
Handler and process flow

This module is called from only Cross framework.

  1. OnContractCall() in module.go is called from Cross framework
  2. contractHandler() set by keeper.HandleContractCall in called
  3. Then it calls function according to request method

Directories

Path Synopsis
modules
erc20mgr/types
Package types is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL