From d75c11c89739ed6df471f04866a58328202fa2ab Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 26 Aug 2020 12:19:40 +0300 Subject: [PATCH] [#15] Check amount value in withdraw method Signed-off-by: Alex Vanin --- neofs_contract.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/neofs_contract.go b/neofs_contract.go index c9cfb82..1f2012b 100644 --- a/neofs_contract.go +++ b/neofs_contract.go @@ -228,10 +228,12 @@ func Withdraw(user []byte, amount int) bool { panic("withdraw: you should be the owner of the wallet") } - if amount > 0 { - amount = amount * 100000000 + if amount < 0 { + panic("withdraw: non positive amount number") } + amount = amount * 100000000 + tx := runtime.GetScriptContainer() runtime.Notify("Withdraw", user, amount, tx.Hash)