// Transfers value of any form (balance, gasDeposit/gasBalance).
Transfers value of any form (balance, gasDeposit/gasBalance).
// Transfers value of any form ( balance gasDeposit / gasBalance ) .
func transferValue(
	unitName string,
	from, to AccountID,
	amount uint64,
	srcRead func(AccountID) (uint64, bool), srcWrite func(AccountID, uint64),
	dstRead func(AccountID) (uint64, bool), dstWrite func(AccountID, uint64),
) error {
	senderValue, _ := srcRead(from)
	if senderValue < amount {
		return errors.Errorf("transfer_value: %x tried send %d %s to %x, but only has %d %s",
			from, amount, unitName, to, senderValue, unitName)
	}
	senderValue -= amount
	srcWrite(from, senderValue)
	recipientValue, _ := dstRead(to)
	recipientValue += amount
	dstWrite(to, recipientValue)
	return nil
}
func transferValue ( unitName string , from , to AccountID , amount uint64 , srcRead func ( AccountID ) ( uint64 , bool ) , srcWrite func ( AccountID , uint64 ) , dstRead func ( AccountID ) ( uint64 , bool ) , dstWrite func ( AccountID , uint64 ) , ) error { senderValue , _ := srcRead ( from ) if senderValue < amount { return errors . Errorf ( " " , from , amount , unitName , to , senderValue , unitName ) } senderValue -= amount srcWrite ( from , senderValue ) recipientValue , _ := dstRead ( to ) recipientValue += amount dstWrite ( to , recipientValue ) return nil }
Transfers value of any form (balance, gasDeposit/gasBalance).
Transfers value of any form ( balance gasDeposit / gasBalance ) .