tx · DkhXEFE3tWUrnw6UmawoacjPHryfSxyZzcu5XETCPwMZ 3MsaXCT52ggYJWZtBEwQJPTrMQcX8zQpABa: -0.01400000 Waves 2021.12.20 14:52 [1842540] smart account 3MsaXCT52ggYJWZtBEwQJPTrMQcX8zQpABa > SELF 0.00000000 Waves
{ "type": 13, "id": "DkhXEFE3tWUrnw6UmawoacjPHryfSxyZzcu5XETCPwMZ", "fee": 1400000, "feeAssetId": null, "timestamp": 1640001080035, "version": 2, "chainId": 84, "sender": "3MsaXCT52ggYJWZtBEwQJPTrMQcX8zQpABa", "senderPublicKey": "3uLRwuGsawQLLWXXct1U2P3ePeRdUZjsv8YZatXH6kBR", "proofs": [ "64K5BAENxVoLJkdM2E1odGBNQBTN9giEdZ5SigB9f9TAiK1cMmdaYSz3UY27rxoyN39hxor6xMgeA78JKjCkUS4N" ], "script": "base64:AAIFAAAAAAAAAJoIAhIECgIICBoSCgFhEg10cnlHZXRJbnRlZ2VyGggKAWISA2tleRoICgFjEgN2YWwaDAoBZBIHJG1hdGNoMBoGCgFlEgFiGgYKAWYSAWkaDAoBZxIHYWRkcmVzcxoMCgFoEgd0eElkU3RyGgoKAWkSBWFzc2V0GgwKAWoSB2Fzc2V0SWQaBwoBaxICdHgaCwoBbBIGdmVyaWZ5AAAAAQEAAAABYQAAAAEAAAABYgQAAAABYwQAAAABZAkABBoAAAACBQAAAAR0aGlzBQAAAAFiAwkAAAEAAAACBQAAAAFkAgAAAANJbnQEAAAAAWUFAAAAAWQFAAAAAWUAAAAAAAAAAAAFAAAAAWMAAAABAAAAAWYBAAAAEWlzc3VlRnJlZUR1Y2tsaW5nAAAAAgAAAAFnAAAAAWgEAAAAAWkJAARDAAAABwIAAAAQQkFCWS0xMTExMTExMS1HWgIAAAAAAAAAAAAAAAABAAAAAAAAAAAABwUAAAAEdW5pdAUAAAAGaGVpZ2h0BAAAAAFqCQAEOAAAAAEFAAAAAWkJAAUUAAAAAgkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAAFnAgAAAAFfBQAAAAFoAgAAAANfZGkJAAJYAAAAAQUAAAABagkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAMc3RhdHNfYW1vdW50CQAAZAAAAAIJAQAAAAFhAAAAAQIAAAAMc3RhdHNfYW1vdW50AAAAAAAAAAABCQAETAAAAAIFAAAAAWkJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAABXZhbHVlAAAAAQkABCYAAAABBQAAAAFnAAAAAAAAAAABBQAAAAFqBQAAAANuaWwCAAAAAAAAAAEAAAABawEAAAABbAAAAAAJAAH0AAAAAwgFAAAAAWsAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAFrAAAABnByb29mcwAAAAAAAAAAAAgFAAAAAWsAAAAPc2VuZGVyUHVibGljS2V54bjcBA==", "height": 1842540, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2TRzVGmctKYYD8VveUQ5WfGRuUwQjp6RvEFxdpRriSjQ Next: 9Xzu6pFWaVUc8GuKsNnXr9S42xtAGmwMG2qZ1JBAkwpd Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func tryGetInteger (key) = { | |
5 | + | let val = match getInteger(this, key) { | |
6 | + | case b: Int => | |
7 | + | b | |
8 | + | case _ => | |
9 | + | 0 | |
10 | + | } | |
11 | + | val | |
12 | + | } | |
4 | 13 | ||
5 | 14 | ||
6 | 15 | @Callable(i) | |
7 | - | func deposit () = { | |
8 | - | let pmt = if ((size(i.payments) == 1)) | |
9 | - | then i.payments[0] | |
10 | - | else throw("Attached payment is required") | |
11 | - | if (isDefined(pmt.assetId)) | |
12 | - | then throw("works with waves only") | |
13 | - | else { | |
14 | - | let currentKey = toBase58String(i.caller.bytes) | |
15 | - | let currentAmount = match getInteger(this, currentKey) { | |
16 | - | case a: Int => | |
17 | - | a | |
18 | - | case _ => | |
19 | - | 0 | |
20 | - | } | |
21 | - | let newAmount = (currentAmount + pmt.amount) | |
22 | - | $Tuple2([IntegerEntry(currentKey, newAmount)], unit) | |
23 | - | } | |
24 | - | } | |
25 | - | ||
26 | - | ||
27 | - | ||
28 | - | @Callable(i) | |
29 | - | func withdraw (amount) = { | |
30 | - | let currentKey = toBase58String(i.caller.bytes) | |
31 | - | let currentAmount = match getInteger(this, currentKey) { | |
32 | - | case a: Int => | |
33 | - | a | |
34 | - | case _ => | |
35 | - | 0 | |
36 | - | } | |
37 | - | let newAmount = (currentAmount - amount) | |
38 | - | if ((0 > amount)) | |
39 | - | then throw("Can't withdraw negative amount") | |
40 | - | else if ((0 > newAmount)) | |
41 | - | then throw("Not enough balance") | |
42 | - | else $Tuple2([IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)], unit) | |
16 | + | func issueFreeDuckling (address,txIdStr) = { | |
17 | + | let asset = Issue("BABY-11111111-GZ", "", 1, 0, false, unit, height) | |
18 | + | let assetId = calculateAssetId(asset) | |
19 | + | $Tuple2([StringEntry((((address + "_") + txIdStr) + "_di"), toBase58String(assetId)), IntegerEntry("stats_amount", (tryGetInteger("stats_amount") + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], "") | |
43 | 20 | } | |
44 | 21 | ||
45 | 22 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func tryGetInteger (key) = { | |
5 | + | let val = match getInteger(this, key) { | |
6 | + | case b: Int => | |
7 | + | b | |
8 | + | case _ => | |
9 | + | 0 | |
10 | + | } | |
11 | + | val | |
12 | + | } | |
4 | 13 | ||
5 | 14 | ||
6 | 15 | @Callable(i) | |
7 | - | func deposit () = { | |
8 | - | let pmt = if ((size(i.payments) == 1)) | |
9 | - | then i.payments[0] | |
10 | - | else throw("Attached payment is required") | |
11 | - | if (isDefined(pmt.assetId)) | |
12 | - | then throw("works with waves only") | |
13 | - | else { | |
14 | - | let currentKey = toBase58String(i.caller.bytes) | |
15 | - | let currentAmount = match getInteger(this, currentKey) { | |
16 | - | case a: Int => | |
17 | - | a | |
18 | - | case _ => | |
19 | - | 0 | |
20 | - | } | |
21 | - | let newAmount = (currentAmount + pmt.amount) | |
22 | - | $Tuple2([IntegerEntry(currentKey, newAmount)], unit) | |
23 | - | } | |
24 | - | } | |
25 | - | ||
26 | - | ||
27 | - | ||
28 | - | @Callable(i) | |
29 | - | func withdraw (amount) = { | |
30 | - | let currentKey = toBase58String(i.caller.bytes) | |
31 | - | let currentAmount = match getInteger(this, currentKey) { | |
32 | - | case a: Int => | |
33 | - | a | |
34 | - | case _ => | |
35 | - | 0 | |
36 | - | } | |
37 | - | let newAmount = (currentAmount - amount) | |
38 | - | if ((0 > amount)) | |
39 | - | then throw("Can't withdraw negative amount") | |
40 | - | else if ((0 > newAmount)) | |
41 | - | then throw("Not enough balance") | |
42 | - | else $Tuple2([IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)], unit) | |
16 | + | func issueFreeDuckling (address,txIdStr) = { | |
17 | + | let asset = Issue("BABY-11111111-GZ", "", 1, 0, false, unit, height) | |
18 | + | let assetId = calculateAssetId(asset) | |
19 | + | $Tuple2([StringEntry((((address + "_") + txIdStr) + "_di"), toBase58String(assetId)), IntegerEntry("stats_amount", (tryGetInteger("stats_amount") + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], "") | |
43 | 20 | } | |
44 | 21 | ||
45 | 22 | ||
46 | 23 | @Verifier(tx) | |
47 | 24 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
48 | 25 |
github/deemru/w8io/169f3d6 21.88 ms ◑![]()