Commit f159931f authored by hezhengjun's avatar hezhengjun Committed by vipwzw

enable evm's asset map from other contractrs configurable

parent 92a81c2c
...@@ -194,6 +194,10 @@ paraConsensusStopBlocks=30000 ...@@ -194,6 +194,10 @@ paraConsensusStopBlocks=30000
total="16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp" total="16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
useBalance=false useBalance=false
[exec.sub.evm]
#平行链evm合约ETH资产映射的合约和资产类型(symbol)
ethMapFromExecutor="paracross"
ethMapFromSymbol="coins.bty"
#系统中所有的fork,默认用chain33的测试网络的 #系统中所有的fork,默认用chain33的测试网络的
#但是我们可以替换 #但是我们可以替换
......
...@@ -19,7 +19,6 @@ import ( ...@@ -19,7 +19,6 @@ import (
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/runtime" "github.com/33cn/plugin/plugin/dapp/evm/executor/vm/runtime"
"github.com/33cn/plugin/plugin/dapp/evm/executor/vm/state" "github.com/33cn/plugin/plugin/dapp/evm/executor/vm/state"
evmtypes "github.com/33cn/plugin/plugin/dapp/evm/types" evmtypes "github.com/33cn/plugin/plugin/dapp/evm/types"
pt "github.com/33cn/plugin/plugin/dapp/paracross/types"
) )
// Exec 本合约执行逻辑 // Exec 本合约执行逻辑
...@@ -180,7 +179,13 @@ func (evm *EVMExecutor) CheckInit() { ...@@ -180,7 +179,13 @@ func (evm *EVMExecutor) CheckInit() {
return return
} }
//平行链 //平行链
accountDB, _ := account.NewAccountDB(evm.GetAPI().GetConfig(), pt.ParaX, "coins.bty", evm.GetStateDB()) conf := types.ConfSub(cfg, evmtypes.ExecutorName)
ethMapFromExecutor := conf.GStr("ethMapFromExecutor")
ethMapFromSymbol := conf.GStr("ethMapFromSymbol")
if "" == ethMapFromExecutor || "" == ethMapFromSymbol {
panic("Both ethMapFromExecutor and ethMapFromSymbol should be configured, " + "ethMapFromExecutor=" + ethMapFromExecutor + ", ethMapFromSymbol=" + ethMapFromSymbol)
}
accountDB, _ := account.NewAccountDB(evm.GetAPI().GetConfig(), ethMapFromExecutor, ethMapFromSymbol, evm.GetStateDB())
evm.mStateDB = state.NewMemoryStateDB(evm.GetStateDB(), evm.GetLocalDB(), accountDB, evm.GetHeight(), evm.GetAPI()) evm.mStateDB = state.NewMemoryStateDB(evm.GetStateDB(), evm.GetLocalDB(), accountDB, evm.GetHeight(), evm.GetAPI())
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment