flintlang / flint

The Flint Programming Language for Smart Contracts
MIT License
245 stars 18 forks source link

transfer() with specified amount in init() #472

Open wmanshu opened 5 years ago

wmanshu commented 5 years ago
 @payable
  public init(implicit _value : inout Wei)
  mutates (Wei.rawValue)
  {
    ...
    let amountToTransfer: Int = _value.rawValue
    self.value = Wei(0)
    value.transfer(source: &_value, amount: amountToTransfer)
    ...
  }

This gives an error in EVM IR Preprocessor: received unexpected type 'errorType' I also tried using exactly same lines in a normal function, it works fine.

The other case, transfer(source: &_value) works fine in init().

wmanshu commented 5 years ago

Also happens to Wei(source: &_value, amount: amountToTransfer)