Created
August 24, 2016 12:49
-
-
Save obscuren/9ae87e237673d3401bbdb1d720dce0f5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
infoContext := vm.InfoContext{ | |
Origin: common.HexToAddress(exeValues["caller"]), | |
Parent: common.HexToHash(envValues["previousHash"]), | |
Coinbase: common.HexToAddress(envValues["currentCoinbase"]), | |
Number: common.Big(envValues["currentNumber"]), | |
Time: common.Big(envValues["currentTimestamp"]), | |
Difficulty: common.Big(envValues["currentDifficulty"]), | |
GasLimit: common.Big(envValues["currentGasLimit"]), | |
GasPrice: common.Big(exeValues["gasPrice"]), | |
} | |
var initialCall bool | |
backend := core.Backend{ | |
GetHashFn: func(n uint64) common.Hash { | |
return common.BytesToHash(crypto.Keccak256([]byte(big.NewInt(int64(n)).String()))) | |
}, | |
State: state, | |
} | |
canTransfer := func(address common.Address, amount *big.Int) bool { | |
if skipTransfer { | |
if initialCall { | |
initialCall = false | |
return true | |
} | |
} | |
return backend.State.GetBalance(from).Cmp(balance) >= 0 | |
} | |
env := vm.NewEnvironment(core.EVMCallContext{canTransfer}, infoContext, backend, ruleSet, vm.Config{}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment