tx · prToFXdPcg4HaXHqWrn1pG6CRse9Uj2V3wFg25yzxh2 3MwcGmLp1yYLtxb7B7A8WSPmGZvzmXuAvLC: -0.01000000 Waves 2022.06.22 08:45 [2107202] smart account 3MwcGmLp1yYLtxb7B7A8WSPmGZvzmXuAvLC > SELF 0.00000000 Waves
{ "type": 13, "id": "prToFXdPcg4HaXHqWrn1pG6CRse9Uj2V3wFg25yzxh2", "fee": 1000000, "feeAssetId": null, "timestamp": 1655876719789, "version": 2, "chainId": 84, "sender": "3MwcGmLp1yYLtxb7B7A8WSPmGZvzmXuAvLC", "senderPublicKey": "GzoJ6SumHDqNyA66DHu5kkJuga2aPjiyk4yqP1Xd4bXr", "proofs": [ "3iDBi1Nsj5rGvfso72yWnKxLhqEvFxRZJ8RSoJXTc6W2iiT1XdZQWhaJ9PrbpxWLdQtUTFLGTF18AVX7p5KziAVs" ], "script": "base64:AAIFAAAAAAAAAAkIAhIFCgMICBgAAAAHAAAAAAtwcmVzZW5jZUtleQIAAAAJcHJlc2VuY2VzAAAAAAphYnNlbmNlS2V5AgAAAAhhYnNlbmNlcwAAAAAKdG90YWxDb3VycwIAAAAKdG90YWxDb3VycwAAAAAKbGVhc2VJZEtleQIAAAAHbGVhc2VJZAEAAAANZ2V0TmJQcmVzZW5jZQAAAAAEAAAACm5iUHJlc2VuY2UJAAQfAAAAAQUAAAALcHJlc2VuY2VLZXkEAAAAByRtYXRjaDAFAAAACm5iUHJlc2VuY2UDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABdAUAAAAHJG1hdGNoMAUAAAABdAAAAAAAAAAAAAEAAAAKZ2V0TmJDb3VycwAAAAAEAAAAB25iQ291cnMJAAQfAAAAAQUAAAAKdG90YWxDb3VycwQAAAAHJG1hdGNoMAUAAAAHbmJDb3VycwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAF0BQAAAAckbWF0Y2gwBQAAAAF0AAAAAAAAAAAAAQAAAAxnZXROYkFic2V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AAAEFAAAAA25pbAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAKYWJzZW5jZUtleQkAAGQAAAACBQAAAAluYkFic2VuY2UAAAAAAAAAAAEJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAACnRvdGFsQ291cnMJAABkAAAAAgUAAAAHbmJDb3VycwAAAAAAAAAAAQkABEwAAAACCQEAAAALTGVhc2VDYW5jZWwAAAABCQEAAAARQGV4dHJOYXRpdmUoMTA1NykAAAABBQAAAApsZWFzZUlkS2V5BQAAAANuaWwAAAAAFgEMgw==", "height": 2107202, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let presenceKey = "presences" | |
5 | + | ||
6 | + | let absenceKey = "absences" | |
7 | + | ||
8 | + | let totalCours = "totalCours" | |
9 | + | ||
10 | + | let leaseIdKey = "leaseId" | |
11 | + | ||
12 | + | func getNbPresence () = { | |
13 | + | let nbPresence = getInteger(presenceKey) | |
14 | + | match nbPresence { | |
15 | + | case t: Int => | |
16 | + | t | |
17 | + | case _ => | |
18 | + | 0 | |
19 | + | } | |
20 | + | } | |
21 | + | ||
22 | + | ||
23 | + | func getNbCours () = { | |
24 | + | let nbCours = getInteger(totalCours) | |
25 | + | match nbCours { | |
26 | + | case t: Int => | |
27 | + | t | |
28 | + | case _ => | |
29 | + | 0 | |
30 | + | } | |
31 | + | } | |
32 | + | ||
33 | + | ||
34 | + | func getNbAbsence () = { | |
35 | + | let nbAbsence = getInteger(absenceKey) | |
36 | + | match nbAbsence { | |
37 | + | case t: Int => | |
38 | + | t | |
39 | + | case _ => | |
40 | + | 0 | |
41 | + | } | |
42 | + | } | |
43 | + | ||
44 | + | ||
45 | + | @Callable(i) | |
46 | + | func validationPresence (presence,addressToLease,addresses) = { | |
47 | + | let nbPresence = getNbPresence() | |
48 | + | let nbCours = getNbCours() | |
49 | + | let nbAbsence = getNbAbsence() | |
50 | + | if ((size(addresses) > 0)) | |
51 | + | then { | |
52 | + | let firstStudent = addressFromStringValue(take(addresses[0], 35)) | |
53 | + | let firstStudentStatus = takeRight(addresses[0], (size(addresses[0]) - 36)) | |
54 | + | let listeAdresses = removeByIndex(addresses, 0) | |
55 | + | let res = invoke(firstStudent, "validationPresence", [firstStudentStatus, addressToLease, listeAdresses], nil) | |
56 | + | if ((res == res)) | |
57 | + | then if ((presence == "présent")) | |
58 | + | then { | |
59 | + | let leasableBalance = (wavesBalance(this).available - 10000000) | |
60 | + | if ((leasableBalance > 0)) | |
61 | + | then { | |
62 | + | let lease = Lease(addressFromStringValue(addressToLease), leasableBalance) | |
63 | + | let leaseId = calculateLeaseId(lease) | |
64 | + | $Tuple2([IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1)), BinaryEntry(leaseIdKey, leaseId), lease], 0) | |
65 | + | } | |
66 | + | else $Tuple2([IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1))], 0) | |
67 | + | } | |
68 | + | else $Tuple2([IntegerEntry(absenceKey, (nbAbsence + 1)), IntegerEntry(totalCours, (nbCours + 1)), LeaseCancel(getBinaryValue(leaseIdKey))], 0) | |
69 | + | else throw("Strict value is not equal to itself.") | |
70 | + | } | |
71 | + | else if ((presence == "présent")) | |
72 | + | then { | |
73 | + | let leasableBalance = (wavesBalance(this).available - 10000000) | |
74 | + | if ((leasableBalance > 0)) | |
75 | + | then { | |
76 | + | let lease = Lease(addressFromStringValue(addressToLease), leasableBalance) | |
77 | + | let leaseId = calculateLeaseId(lease) | |
78 | + | [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1)), BinaryEntry(leaseIdKey, leaseId), lease] | |
79 | + | } | |
80 | + | else [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1))] | |
81 | + | } | |
82 | + | else [IntegerEntry(absenceKey, (nbAbsence + 1)), IntegerEntry(totalCours, (nbCours + 1)), LeaseCancel(getBinaryValue(leaseIdKey))] | |
83 | + | } | |
84 | + | ||
85 | + |
github/deemru/w8io/026f985 17.15 ms ◑