示例#1
0
文件: util.go 项目: ski/go-ethereum
func (self *Env) CanTransfer(from vm.Account, balance *big.Int) bool {
	if self.skipTransfer {
		if self.initial {
			self.initial = false
			return true
		}
	}

	return from.Balance().Cmp(balance) >= 0
}
示例#2
0
func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error {
	if self.skipTransfer {
		// ugly hack
		if self.initial {
			self.initial = false
			return nil
		}

		if from.Balance().Cmp(amount) < 0 {
			return errors.New("Insufficient balance in account")
		}

		return nil
	}
	return vm.Transfer(from, to, amount)
}
示例#3
0
// generic transfer method
func Transfer(from, to vm.Account, amount *big.Int) {
	from.SubBalance(amount)
	to.AddBalance(amount)
}
示例#4
0
func (self *VMEnv) CanTransfer(from vm.Account, balance *big.Int) bool {
	return from.Balance().Cmp(balance) >= 0
}