Skip to content

Commit 162007f

Browse files
deduct balance if balance less then fees (#221)
1 parent 5051831 commit 162007f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

contracts/FlowServiceAccount.cdc

+6-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,12 @@ pub contract FlowServiceAccount {
6767
}
6868

6969
let tokenVault = self.defaultTokenVault(acct)
70-
let feeVault <- tokenVault.withdraw(amount: self.transactionFee)
71-
70+
var feeAmount = self.transactionFee
71+
if self.transactionFee > tokenVault.balance {
72+
feeAmount = tokenVault.balance
73+
}
74+
75+
let feeVault <- tokenVault.withdraw(amount: feeAmount)
7276
FlowFees.deposit(from: <-feeVault)
7377
}
7478

lib/go/contracts/internal/assets/assets.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)