tx · Gw9MFuHHPPM6h57iQHR4wsoEBN9AJAjRHnooJqb27Wfq 3N5RAMPJE4xs7mfEqKaHmhuWgVjXbK6dfGc: -0.01000000 Waves 2022.02.04 17:41 [1909007] smart account 3N5RAMPJE4xs7mfEqKaHmhuWgVjXbK6dfGc > SELF 0.00000000 Waves
{ "type": 13, "id": "Gw9MFuHHPPM6h57iQHR4wsoEBN9AJAjRHnooJqb27Wfq", "fee": 1000000, "feeAssetId": null, "timestamp": 1643985716594, "version": 2, "chainId": 84, "sender": "3N5RAMPJE4xs7mfEqKaHmhuWgVjXbK6dfGc", "senderPublicKey": "EAog7JJhHByJAZz8XubAMQbtFA3hXBrwbb3goJoVDs4Q", "proofs": [ "2k45NmtKAxE1LSihfNc4L6sfKoCPoRPupRRD9tEPNAXg9gxzRsiqqFhM35ktYoNM7oETMDRgHP9ruBh2N6RKgRpG" ], "script": "base64:AAIFAAAAAAAAAAkIAhIFCgMICBgAAAAHAAAAAAtwcmVzZW5jZUtleQIAAAAJcHJlc2VuY2VzAAAAAAphYnNlbmNlS2V5AgAAAAhhYnNlbmNlcwAAAAAKdG90YWxDb3VycwIAAAAKdG90YWxDb3VycwAAAAAKbGVhc2VJZEtleQIAAAAHbGVhc2VJZAEAAAANZ2V0TmJQcmVzZW5jZQAAAAAEAAAACm5iUHJlc2VuY2UJAAQfAAAAAQUAAAALcHJlc2VuY2VLZXkEAAAAByRtYXRjaDAFAAAACm5iUHJlc2VuY2UDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABdAUAAAAHJG1hdGNoMAUAAAABdAAAAAAAAAAAAAEAAAAKZ2V0TmJDb3VycwAAAAAEAAAAB25iQ291cnMJAAQfAAAAAQUAAAAKdG90YWxDb3VycwQAAAAHJG1hdGNoMAUAAAAHbmJDb3VycwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAF0BQAAAAckbWF0Y2gwBQAAAAF0AAAAAAAAAAAAAQAAAAxnZXROYkFic2V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W5jZUtleQkAAGQAAAACBQAAAAluYkFic2VuY2UAAAAAAAAAAAEJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAACnRvdGFsQ291cnMJAABkAAAAAgUAAAAHbmJDb3VycwAAAAAAAAAAAQkABEwAAAACCQEAAAALTGVhc2VDYW5jZWwAAAABCQEAAAARQGV4dHJOYXRpdmUoMTA1NykAAAABBQAAAApsZWFzZUlkS2V5BQAAAANuaWwAAAAAOXtMWA==", "height": 1909007, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4AnjzMjYD8mwBgUQ6TJxuFgBAZceJHhiDkio13vEXmSf Next: C6oz4cMV5tzMdNBAjPmjFUB1t4yvZBQFTkcxGJpkpiSe Diff:
Old | New | Differences | |
---|---|---|---|
43 | 43 | ||
44 | 44 | ||
45 | 45 | @Callable(i) | |
46 | - | func validationPresence (presence,addressToLease) = { | |
46 | + | func validationPresence (presence,addressToLease,addresses) = { | |
47 | 47 | let nbPresence = getNbPresence() | |
48 | 48 | let nbCours = getNbCours() | |
49 | 49 | let nbAbsence = getNbAbsence() | |
50 | - | if (( | |
50 | + | if ((size(addresses) > 0)) | |
51 | 51 | then { | |
52 | - | let leasableBalance = (wavesBalance(this).available - 10000000) | |
53 | - | if ((leasableBalance > 0)) | |
54 | - | then { | |
55 | - | let lease = Lease(addressFromStringValue(addressToLease), leasableBalance) | |
56 | - | let leaseId = calculateLeaseId(lease) | |
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) | |
57 | 64 | [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1)), BinaryEntry(leaseIdKey, leaseId), lease] | |
58 | - | } | |
59 | - | else [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1))] | |
65 | + | } | |
66 | + | else [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1))] | |
67 | + | } | |
68 | + | else [IntegerEntry(absenceKey, (nbAbsence + 1)), IntegerEntry(totalCours, (nbCours + 1)), LeaseCancel(getBinaryValue(leaseIdKey))] | |
69 | + | else throw("Strict value is not equal to itself.") | |
60 | 70 | } | |
61 | - | else $Tuple2([IntegerEntry(absenceKey, (nbAbsence + 1)), IntegerEntry(totalCours, (nbCours + 1)), LeaseCancel(getBinaryValue(leaseIdKey))], 0) | |
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))] | |
62 | 83 | } | |
63 | 84 | ||
64 | 85 |
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 | - | func validationPresence (presence,addressToLease) = { | |
46 | + | func validationPresence (presence,addressToLease,addresses) = { | |
47 | 47 | let nbPresence = getNbPresence() | |
48 | 48 | let nbCours = getNbCours() | |
49 | 49 | let nbAbsence = getNbAbsence() | |
50 | - | if (( | |
50 | + | if ((size(addresses) > 0)) | |
51 | 51 | then { | |
52 | - | let leasableBalance = (wavesBalance(this).available - 10000000) | |
53 | - | if ((leasableBalance > 0)) | |
54 | - | then { | |
55 | - | let lease = Lease(addressFromStringValue(addressToLease), leasableBalance) | |
56 | - | let leaseId = calculateLeaseId(lease) | |
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) | |
57 | 64 | [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1)), BinaryEntry(leaseIdKey, leaseId), lease] | |
58 | - | } | |
59 | - | else [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1))] | |
65 | + | } | |
66 | + | else [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1))] | |
67 | + | } | |
68 | + | else [IntegerEntry(absenceKey, (nbAbsence + 1)), IntegerEntry(totalCours, (nbCours + 1)), LeaseCancel(getBinaryValue(leaseIdKey))] | |
69 | + | else throw("Strict value is not equal to itself.") | |
60 | 70 | } | |
61 | - | else $Tuple2([IntegerEntry(absenceKey, (nbAbsence + 1)), IntegerEntry(totalCours, (nbCours + 1)), LeaseCancel(getBinaryValue(leaseIdKey))], 0) | |
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))] | |
62 | 83 | } | |
63 | 84 | ||
64 | 85 |
github/deemru/w8io/169f3d6 25.02 ms ◑