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

Method AddBalance

core/state/state_object.go:238–249  ·  view source on GitHub ↗

AddBalance removes amount from c's balance. It is used to add funds to the destination account of a transfer.

(amount *big.Int)

Source from the content-addressed store, hash-verified

236// AddBalance removes amount from c's balance.
237// It is used to add funds to the destination account of a transfer.
238func (c *stateObject) AddBalance(amount *big.Int) {
239 // EIP158: We must check emptiness for the objects such that the account
240 // clearing (0,0,0 objects) can take effect.
241 if amount.Sign() == 0 {
242 if c.empty() {
243 c.touch()
244 }
245
246 return
247 }
248 c.SetBalance(new(big.Int).Add(c.Balance(), amount))
249}
250
251// SubBalance removes amount from c's balance.
252// It is used to remove funds from the origin account of a transfer.

Callers

nothing calls this directly

Calls 6

emptyMethod · 0.95
touchMethod · 0.95
SetBalanceMethod · 0.95
BalanceMethod · 0.95
AddMethod · 0.65
SignMethod · 0.45

Tested by

no test coverage detected