tx · 5K9e9dPw2NV47zr2VdqywautqEdcNbE78gJVyGQe8yCg

3N5ZhGLzDmoMwHsWKAoTqkFvVYuditKPyvY:  -0.01000000 Waves

2022.11.14 15:56 [2316828] smart account 3N5ZhGLzDmoMwHsWKAoTqkFvVYuditKPyvY > SELF 0.00000000 Waves

{ "type": 13, "id": "5K9e9dPw2NV47zr2VdqywautqEdcNbE78gJVyGQe8yCg", "fee": 1000000, "feeAssetId": null, "timestamp": 1668430621780, "version": 2, "chainId": 84, "sender": "3N5ZhGLzDmoMwHsWKAoTqkFvVYuditKPyvY", "senderPublicKey": "7mgUaX6yf7mFk48Gus7kVGRUwCZXtr2CKWJW6KoukPiW", "proofs": [ "3n5b3pM7vVRxQfQjmfTFLkBKwSkwRK8jDjfG76v27BCvXdLQPLtmeLtgvEYZouhWuFzdYNRnWEo4UQhvxHagr98Y" ], "script": "base64:AAIFAAAAAAAAAA4IAhIAEgMKAQESAwoBAQAAAAEAAAAABnVzZG5JRAEAAAAgD/IcEqzkxDya7EYaqyWosOy6BytGzG2IcvC14pJJAbQAAAADAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAANwbXQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAABmNhbGxlcgkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAABnVzZG5JRAkAAAIAAAABAgAAAA1JbnZhbGlkIGFzc2V0BAAAAAlkZXBvc2l0ZWQJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwUAAAAGY2FsbGVyAAAAAAAAAAAABAAAAAFzCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAGY2FsbGVyCQAAZAAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAAlkZXBvc2l0ZWQEAAAAB29uU3Rha2UJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAA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AAAGYW1vdW50BQAAAAtmb3JXaXRoZHJhdwkAAAIAAAABAgAAABNOb3QgZW5vdWdoIHRvIGNsYWltCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIFAAAABmNhbGxlcgIAAAAJX3dpdGhkcmF3CQAAZQAAAAIFAAAAC2ZvcldpdGhkcmF3BQAAAAZhbW91bnQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABnVzZG5JRAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXliyYFz", "height": 2316828, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5Sn25VTaaJXYJFWvK2ZaoGtwnBcvr8eARjgUHiTEbwkW Next: FgRKmwBWbK5duirG2QVx6o4Ceb8SJon7QfXeKuGfDLKG Diff:
OldNewDifferences
2121
2222
2323 @Callable(i)
24-func withdraw () = {
24+func withdraw (amount) = {
2525 let caller = toString(i.caller)
2626 let pmt = i.payments[0]
2727 let callerBalance = valueOrElse(getInteger(this, caller), 0)
2828 if ((callerBalance == 0))
2929 then throw("Nothing to withdraw")
30- else [IntegerEntry(caller, (callerBalance - pmt.amount)), ScriptTransfer(i.caller, pmt.amount, usdnID)]
30+ else if ((0 >= amount))
31+ then throw("Invalid input")
32+ else [IntegerEntry(caller, (callerBalance - pmt.amount)), ScriptTransfer(i.caller, pmt.amount, usdnID)]
3133 }
3234
3335
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let usdnID = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT'
55
66 @Callable(i)
77 func deposit () = {
88 let pmt = i.payments[0]
99 let caller = toString(i.caller)
1010 if ((pmt.assetId != usdnID))
1111 then throw("Invalid asset")
1212 else {
1313 let deposited = valueOrElse(getInteger(this, caller), 0)
1414 let s = IntegerEntry(caller, (pmt.amount + deposited))
1515 let onStake = valueOrElse(getInteger(this, "_tresury"), 0)
1616 let updateTreasury = IntegerEntry("_treasury", (pmt.amount + onStake))
1717 [s, updateTreasury]
1818 }
1919 }
2020
2121
2222
2323 @Callable(i)
24-func withdraw () = {
24+func withdraw (amount) = {
2525 let caller = toString(i.caller)
2626 let pmt = i.payments[0]
2727 let callerBalance = valueOrElse(getInteger(this, caller), 0)
2828 if ((callerBalance == 0))
2929 then throw("Nothing to withdraw")
30- else [IntegerEntry(caller, (callerBalance - pmt.amount)), ScriptTransfer(i.caller, pmt.amount, usdnID)]
30+ else if ((0 >= amount))
31+ then throw("Invalid input")
32+ else [IntegerEntry(caller, (callerBalance - pmt.amount)), ScriptTransfer(i.caller, pmt.amount, usdnID)]
3133 }
3234
3335
3436
3537 @Callable(i)
3638 func claim (amount) = {
3739 let caller = toString(i.caller)
3840 let forWithdraw = getIntegerValue(this, caller)
3941 if ((amount > forWithdraw))
4042 then throw("Not enough to claim")
4143 else [IntegerEntry((caller + "_withdraw"), (forWithdraw - amount)), ScriptTransfer(i.caller, amount, usdnID)]
4244 }
4345
4446
4547 @Verifier(tx)
4648 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
4749

github/deemru/w8io/169f3d6 
24.51 ms