MCPcopy Create free account
hub / github.com/CPChain/chain / CanTransfer

Function CanTransfer

core/evm.go:89–91  ·  view source on GitHub ↗

CanTransfer checks wether there are enough funds in the address' account to make a transfer. This does not take the necessary gas in to account to make the transfer valid.

(db vm.StateDB, addr common.Address, amount *big.Int)

Source from the content-addressed store, hash-verified

87// CanTransfer checks wether there are enough funds in the address' account to make a transfer.
88// This does not take the necessary gas in to account to make the transfer valid.
89func CanTransfer(db vm.StateDB, addr common.Address, amount *big.Int) bool {
90 return db.GetBalance(addr).Cmp(amount) >= 0
91}
92
93// Transfer subtracts amount from sender and adds amount to recipient using the given Db
94func Transfer(db vm.StateDB, sender, recipient common.Address, amount *big.Int) {

Callers

nothing calls this directly

Calls 2

CmpMethod · 0.80
GetBalanceMethod · 0.65

Tested by

no test coverage detected