-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5833912
commit 359c74c
Showing
7 changed files
with
146 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,3 +69,4 @@ type EVMKeeper interface { | |
type ICS20Keeper interface{ | ||
HasTrace(ctx sdk.Context, denom string) bool | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package mocks | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/common" | ||
|
||
tokentypes "github.com/irisnet/irismod/modules/token/types" | ||
) | ||
|
||
// ProvideEVMKeeper returns an instance of tokentypes.EVMKeeper. | ||
// | ||
// No parameters. | ||
// Returns a tokentypes.EVMKeeper. | ||
func ProvideEVMKeeper() tokentypes.EVMKeeper { | ||
return &evm{ | ||
erc20s: make(map[common.Address]*erc20), | ||
} | ||
} | ||
|
||
// ProvideICS20Keeper returns an instance of tokentypes.ICS20Keeper. | ||
// | ||
// No parameters. | ||
// Returns a tokentypes.ICS20Keeper. | ||
func ProvideICS20Keeper() tokentypes.ICS20Keeper { | ||
return &transferKeeper{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package mocks | ||
|
||
import ( | ||
"context" | ||
"math/big" | ||
|
||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core" | ||
"github.com/ethereum/go-ethereum/core/vm" | ||
|
||
tokentypes "github.com/irisnet/irismod/modules/token/types" | ||
"github.com/irisnet/irismod/types" | ||
) | ||
|
||
var ( | ||
_ tokentypes.EVMKeeper = (*evm)(nil) | ||
_ tokentypes.ICS20Keeper = (*transferKeeper)(nil) | ||
) | ||
|
||
type evm struct { | ||
erc20s map[common.Address]*erc20 | ||
} | ||
|
||
// ApplyMessage implements types.EVMKeeper. | ||
func (e *evm) ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLogger, commit bool) (*types.Result, error) { | ||
panic("unimplemented") | ||
} | ||
|
||
// ChainID implements types.EVMKeeper. | ||
func (e *evm) ChainID() *big.Int { | ||
return big.NewInt(16688) | ||
} | ||
|
||
// EstimateGas implements types.EVMKeeper. | ||
func (e *evm) EstimateGas(ctx context.Context, req *types.EthCallRequest) (uint64, error) { | ||
return 3000000, nil | ||
} | ||
|
||
// FeeDenom implements types.EVMKeeper. | ||
func (e *evm) FeeDenom() string { | ||
return "eris" | ||
} | ||
|
||
// SupportedKey implements types.EVMKeeper. | ||
func (e *evm) SupportedKey(pubKey cryptotypes.PubKey) bool { | ||
return true | ||
} | ||
|
||
type erc20 struct { | ||
scale int8 | ||
name, symbol string | ||
|
||
balance map[common.Address]*big.Int | ||
} | ||
|
||
type transferKeeper struct{} | ||
|
||
// HasTrace implements types.ICS20Keeper. | ||
func (t *transferKeeper) HasTrace(ctx sdk.Context, denom string) bool { | ||
return true | ||
} |