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
- Mint(account string, amount int64)
- create
amount
tokens and assigns them to account
, increasing the total supply
- Burn(account string, amount int64)
- destroy
amount
tokens from account
, reducing the total supply
- Transfer(spender, recipient string, amount int64)
- move
amount
of tokens from sender
to recipient
- Approve(owner string, spender string, amount int64)
- approve sets
amount
as the allowance of spender
over the caller's tokens
- 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
- 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.
- BalanceOf(account string)
- return the amount of tokens owned by
account
- TotalSupply()
- return the amount of tokens in existence
Handler and process flow
This module includes handler.go
- Message MsgContractCallTx is submitted from CLI.
NewHandler()
is called from Route()
in module.go
handleContractCallTx()
in NewHandler()
is called
HandleContractCall()
in keepr.go
is called
- Then it calls function according to request method
Erc20contract module
This module is a Contract Module of Cross Framework called from Contract Manager.
Functionalities
- Transfer
- call
Transfer
of erc20mgr contract
Handler and process flow
This module is called from only Cross framework
.
- OnContractCall() in
module.go
is called from Cross framework
contractHandler()
set by keeper.HandleContractCall
in called
- Then it calls function according to request method