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/IcEqzkxDya7EYaqyWosOy6BytGzG2IcvC14pJJAbQAAAADAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAANwbXQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAABmNhbGxlcgkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAABnVzZG5JRAkAAAIAAAABAgAAAA1JbnZhbGlkIGFzc2V0BAAAAAlkZXBvc2l0ZWQJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwUAAAAGY2FsbGVyAAAAAAAAAAAABAAAAAFzCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAGY2FsbGVyCQAAZAAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAAlkZXBvc2l0ZWQEAAAAB29uU3Rha2UJAQAAAAt2YWx1ZU9yRWxzZQAAAAI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mAAAAAgUAAAAGYW1vdW50BQAAAAtmb3JXaXRoZHJhdwkAAAIAAAABAgAAABNOb3QgZW5vdWdoIHRvIGNsYWltCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIFAAAABmNhbGxlcgIAAAAJX3dpdGhkcmF3CQAAZQAAAAIFAAAAC2ZvcldpdGhkcmF3BQAAAAZhbW91bnQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABnVzZG5JRAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXliyYFz",
"height": 2316828,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 5Sn25VTaaJXYJFWvK2ZaoGtwnBcvr8eARjgUHiTEbwkW
Next: FgRKmwBWbK5duirG2QVx6o4Ceb8SJon7QfXeKuGfDLKG
Diff:
Old | New | | Differences |
---|
21 | 21 | | |
---|
22 | 22 | | |
---|
23 | 23 | | @Callable(i) |
---|
24 | | - | func withdraw () = { |
---|
| 24 | + | func withdraw (amount) = { |
---|
25 | 25 | | let caller = toString(i.caller) |
---|
26 | 26 | | let pmt = i.payments[0] |
---|
27 | 27 | | let callerBalance = valueOrElse(getInteger(this, caller), 0) |
---|
28 | 28 | | if ((callerBalance == 0)) |
---|
29 | 29 | | 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)] |
---|
31 | 33 | | } |
---|
32 | 34 | | |
---|
33 | 35 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let usdnID = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func deposit () = { |
---|
8 | 8 | | let pmt = i.payments[0] |
---|
9 | 9 | | let caller = toString(i.caller) |
---|
10 | 10 | | if ((pmt.assetId != usdnID)) |
---|
11 | 11 | | then throw("Invalid asset") |
---|
12 | 12 | | else { |
---|
13 | 13 | | let deposited = valueOrElse(getInteger(this, caller), 0) |
---|
14 | 14 | | let s = IntegerEntry(caller, (pmt.amount + deposited)) |
---|
15 | 15 | | let onStake = valueOrElse(getInteger(this, "_tresury"), 0) |
---|
16 | 16 | | let updateTreasury = IntegerEntry("_treasury", (pmt.amount + onStake)) |
---|
17 | 17 | | [s, updateTreasury] |
---|
18 | 18 | | } |
---|
19 | 19 | | } |
---|
20 | 20 | | |
---|
21 | 21 | | |
---|
22 | 22 | | |
---|
23 | 23 | | @Callable(i) |
---|
24 | | - | func withdraw () = { |
---|
| 24 | + | func withdraw (amount) = { |
---|
25 | 25 | | let caller = toString(i.caller) |
---|
26 | 26 | | let pmt = i.payments[0] |
---|
27 | 27 | | let callerBalance = valueOrElse(getInteger(this, caller), 0) |
---|
28 | 28 | | if ((callerBalance == 0)) |
---|
29 | 29 | | 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)] |
---|
31 | 33 | | } |
---|
32 | 34 | | |
---|
33 | 35 | | |
---|
34 | 36 | | |
---|
35 | 37 | | @Callable(i) |
---|
36 | 38 | | func claim (amount) = { |
---|
37 | 39 | | let caller = toString(i.caller) |
---|
38 | 40 | | let forWithdraw = getIntegerValue(this, caller) |
---|
39 | 41 | | if ((amount > forWithdraw)) |
---|
40 | 42 | | then throw("Not enough to claim") |
---|
41 | 43 | | else [IntegerEntry((caller + "_withdraw"), (forWithdraw - amount)), ScriptTransfer(i.caller, amount, usdnID)] |
---|
42 | 44 | | } |
---|
43 | 45 | | |
---|
44 | 46 | | |
---|
45 | 47 | | @Verifier(tx) |
---|
46 | 48 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
47 | 49 | | |
---|