tx · 4AnjzMjYD8mwBgUQ6TJxuFgBAZceJHhiDkio13vEXmSf 3N5RAMPJE4xs7mfEqKaHmhuWgVjXbK6dfGc: -0.01000000 Waves 2022.02.04 17:24 [1908988] smart account 3N5RAMPJE4xs7mfEqKaHmhuWgVjXbK6dfGc > SELF 0.00000000 Waves
{ "type": 13, "id": "4AnjzMjYD8mwBgUQ6TJxuFgBAZceJHhiDkio13vEXmSf", "fee": 1000000, "feeAssetId": null, "timestamp": 1643984693401, "version": 2, "chainId": 84, "sender": "3N5RAMPJE4xs7mfEqKaHmhuWgVjXbK6dfGc", "senderPublicKey": "EAog7JJhHByJAZz8XubAMQbtFA3hXBrwbb3goJoVDs4Q", "proofs": [ "3p2n2tyhrGWPF2ZvwJw5UdmLmDaaGnHHmsNFqrNtRj2Apj5v1PK4ZwAxdFWzPDUvARv6X6miXpd4d7EQUgtYy1Kk" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIICAAAAAcAAAAAC3ByZXNlbmNlS2V5AgAAAAlwcmVzZW5jZXMAAAAACmFic2VuY2VLZXkCAAAACGFic2VuY2VzAAAAAAp0b3RhbENvdXJzAgAAAAp0b3RhbENvdXJzAAAAAApsZWFzZUlkS2V5AgAAAAdsZWFzZUlkAQAAAA1nZXROYlByZXNlbmNlAAAAAAQAAAAKbmJQcmVzZW5jZQkABB8AAAABBQAAAAtwcmVzZW5jZUtleQQAAAAHJG1hdGNoMAUAAAAKbmJQcmVzZW5jZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAF0BQAAAAckbWF0Y2gwBQAAAAF0AAAAAAAAAAAAAQAAAApnZXROYkNvdXJzAAAAAAQAAAAHbmJDb3VycwkABB8AAAABBQAAAAp0b3RhbENvdXJzBAAAAAckbWF0Y2gwBQAAAAduYkNvdXJzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAXQFAAAAByRtYXRjaDAFAAAAAXQAAAAAAAAAAAABAAAADGdldE5iQWJzZ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nZXJFbnRyeQAAAAIFAAAAC3ByZXNlbmNlS2V5CQAAZAAAAAIFAAAACm5iUHJlc2VuY2UAAAAAAAAAAAEJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAACnRvdGFsQ291cnMJAABkAAAAAgUAAAAHbmJDb3VycwAAAAAAAAAAAQUAAAADbmlsCQAFFAAAAAIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAACmFic2VuY2VLZXkJAABkAAAAAgUAAAAJbmJBYnNlbmNlAAAAAAAAAAABCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAp0b3RhbENvdXJzCQAAZAAAAAIFAAAAB25iQ291cnMAAAAAAAAAAAEJAARMAAAAAgkBAAAAC0xlYXNlQ2FuY2VsAAAAAQkBAAAAEUBleHRyTmF0aXZlKDEwNTcpAAAAAQUAAAAKbGVhc2VJZEtleQUAAAADbmlsAAAAAAAAAAAAAAAAACPLck4=", "height": 1908988, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9o9PeFnQKgJ1JgmECvAa4SUjoF95b9GsrYvC5L3MBfhz Next: Gw9MFuHHPPM6h57iQHR4wsoEBN9AJAjRHnooJqb27Wfq Diff:
Old | New | Differences | |
---|---|---|---|
50 | 50 | if ((presence == "présent")) | |
51 | 51 | then { | |
52 | 52 | let leasableBalance = (wavesBalance(this).available - 10000000) | |
53 | - | let lease = Lease(addressFromStringValue(addressToLease), leasableBalance) | |
54 | - | let leaseId = calculateLeaseId(lease) | |
55 | - | $Tuple2([IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1)), BinaryEntry(leaseIdKey, leaseId), lease], 0) | |
53 | + | if ((leasableBalance > 0)) | |
54 | + | then { | |
55 | + | let lease = Lease(addressFromStringValue(addressToLease), leasableBalance) | |
56 | + | let leaseId = calculateLeaseId(lease) | |
57 | + | [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1)), BinaryEntry(leaseIdKey, leaseId), lease] | |
58 | + | } | |
59 | + | else [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1))] | |
56 | 60 | } | |
57 | - | else $Tuple2([IntegerEntry(absenceKey, ( | |
61 | + | else $Tuple2([IntegerEntry(absenceKey, (nbAbsence + 1)), IntegerEntry(totalCours, (nbCours + 1)), LeaseCancel(getBinaryValue(leaseIdKey))], 0) | |
58 | 62 | } | |
59 | 63 | ||
60 | 64 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let presenceKey = "presences" | |
5 | 5 | ||
6 | 6 | let absenceKey = "absences" | |
7 | 7 | ||
8 | 8 | let totalCours = "totalCours" | |
9 | 9 | ||
10 | 10 | let leaseIdKey = "leaseId" | |
11 | 11 | ||
12 | 12 | func getNbPresence () = { | |
13 | 13 | let nbPresence = getInteger(presenceKey) | |
14 | 14 | match nbPresence { | |
15 | 15 | case t: Int => | |
16 | 16 | t | |
17 | 17 | case _ => | |
18 | 18 | 0 | |
19 | 19 | } | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func getNbCours () = { | |
24 | 24 | let nbCours = getInteger(totalCours) | |
25 | 25 | match nbCours { | |
26 | 26 | case t: Int => | |
27 | 27 | t | |
28 | 28 | case _ => | |
29 | 29 | 0 | |
30 | 30 | } | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getNbAbsence () = { | |
35 | 35 | let nbAbsence = getInteger(absenceKey) | |
36 | 36 | match nbAbsence { | |
37 | 37 | case t: Int => | |
38 | 38 | t | |
39 | 39 | case _ => | |
40 | 40 | 0 | |
41 | 41 | } | |
42 | 42 | } | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | @Callable(i) | |
46 | 46 | func validationPresence (presence,addressToLease) = { | |
47 | 47 | let nbPresence = getNbPresence() | |
48 | 48 | let nbCours = getNbCours() | |
49 | 49 | let nbAbsence = getNbAbsence() | |
50 | 50 | if ((presence == "présent")) | |
51 | 51 | then { | |
52 | 52 | let leasableBalance = (wavesBalance(this).available - 10000000) | |
53 | - | let lease = Lease(addressFromStringValue(addressToLease), leasableBalance) | |
54 | - | let leaseId = calculateLeaseId(lease) | |
55 | - | $Tuple2([IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1)), BinaryEntry(leaseIdKey, leaseId), lease], 0) | |
53 | + | if ((leasableBalance > 0)) | |
54 | + | then { | |
55 | + | let lease = Lease(addressFromStringValue(addressToLease), leasableBalance) | |
56 | + | let leaseId = calculateLeaseId(lease) | |
57 | + | [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1)), BinaryEntry(leaseIdKey, leaseId), lease] | |
58 | + | } | |
59 | + | else [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1))] | |
56 | 60 | } | |
57 | - | else $Tuple2([IntegerEntry(absenceKey, ( | |
61 | + | else $Tuple2([IntegerEntry(absenceKey, (nbAbsence + 1)), IntegerEntry(totalCours, (nbCours + 1)), LeaseCancel(getBinaryValue(leaseIdKey))], 0) | |
58 | 62 | } | |
59 | 63 | ||
60 | 64 |
github/deemru/w8io/169f3d6 31.26 ms ◑