Skip to content

Commit 8749650

Browse files
committed
simplify
1 parent 94d89c9 commit 8749650

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

interpreter/interpreter.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -485,20 +485,13 @@ func (s *programState) trySending(source parser.Source, amount big.Int) (*big.In
485485
balance := s.getBalance(*name, s.CurrentAsset)
486486
// "overdraft up to `source.Bounded`"
487487
if source.Bounded != nil {
488-
upTo, err := evaluateLitExpecting(s, *source.Bounded, expectMonetary)
488+
upTo, err := evaluateLitExpecting(s, *source.Bounded, expectMonetaryOfAsset(s.CurrentAsset))
489489
if err != nil {
490490
return nil, err
491491
}
492492

493-
if string(upTo.Asset) != s.CurrentAsset {
494-
return nil, MismatchedCurrencyError{
495-
Expected: s.CurrentAsset,
496-
Got: string(upTo.Asset),
497-
}
498-
}
499-
500493
var balancePlusOverdraft big.Int
501-
balancePlusOverdraft.Add(balance, (*big.Int)(&upTo.Amount))
494+
balancePlusOverdraft.Add(balance, upTo)
502495
// check that amount > balance + overdraft
503496
if amount.Cmp(&balancePlusOverdraft) == 1 {
504497
var missing big.Int

0 commit comments

Comments
 (0)