tx · Ffga2KfYKHkzycqePDoaqvePHgKAyM6ksXxpNFhtLw2D 3N9bnBDbTLpgTYvhezFE8rSJyMEBBTH927Q: -0.01000000 Waves 2022.02.04 00:26 [1907968] smart account 3N9bnBDbTLpgTYvhezFE8rSJyMEBBTH927Q > SELF 0.00000000 Waves
{ "type": 13, "id": "Ffga2KfYKHkzycqePDoaqvePHgKAyM6ksXxpNFhtLw2D", "fee": 1000000, "feeAssetId": null, "timestamp": 1643923607536, "version": 2, "chainId": 84, "sender": "3N9bnBDbTLpgTYvhezFE8rSJyMEBBTH927Q", "senderPublicKey": "5tuiuQhSLUFHipVYrx5LHsWSRaDfEFeJCoXdGBKeuwr1", "proofs": [ "5pYY6FhYV6w1Qk1uMHfqCb9tLgEAmNFTTWkVnJhXNwACz9uBb2SpaB61rNyVepNfDSBkmnBb9DkPRMvjkyAEgk5D" ], "script": "base64:AAIFAAAAAAAAASYIAhIECgIICBoQCgFhEgtwcmVzZW5jZUtleRoPCgFiEgphYnNlbmNlS2V5Gg8KAWMSCnRvdGFsQ291cnMaDwoBZBIKbGVhc2VJZEtleRoSCgFlEg1nZXROYlByZXNlbmNlGg8KAWYSCm5iUHJlc2VuY2UaDAoBZxIHJG1hdGNoMBoGCgFoEgF0Gg8KAWkSCmdldE5iQ291cnMaDAoBahIHbmJDb3VycxoRCgFrEgxnZXROYkFic2VuY2UaDgoBbBIJbmJBYnNlbmNlGgYKAW0SAWkaDQoBbhIIcHJlc2VuY2UaEwoBbxIOYWRkcmVzc1RvTGVhc2UaFAoBcBIPbGVhc2FibGVCYWxhbmNlGgoKAXESBWxlYXNlGgwKAXISB2xlYXNlSWQAAAAHAAAAAAFhAgAAAAlwcmVzZW5jZXMAAAAAAWICAAAACGFic2VuY2VzAAAAAAFjAgAAAAp0b3RhbENvdXJzAAAAAAFkAgAAAAdsZWFzZUlkAQAAAAFlAAAAAAQAAAABZgkABB8AAAABBQAAAAFhBAAAAAFnBQAAAAFmAwkAAAEAAAACBQAAAAFnA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AAtMZWFzZUNhbmNlbAAAAAEJAQAAABFAZXh0ck5hdGl2ZSgxMDU3KQAAAAEFAAAAAWQFAAAAA25pbAAAAAAxPiV1", "height": 1907968, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3eyMNrcu1MNv1znrrj1TMdS5DjW5Er6ursUeEtJzAmDK Next: DARecZWXwi87dcF5qMFiqDTWp1XXTG34A6rzGCRcfMMs Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let presenceKey = "presences" | |
5 | 5 | ||
6 | - | let | |
6 | + | let absenceKey = "absences" | |
7 | 7 | ||
8 | - | let | |
8 | + | let totalCours = "totalCours" | |
9 | 9 | ||
10 | - | ||
10 | + | let leaseIdKey = "leaseId" | |
11 | 11 | ||
12 | - | ||
13 | - | ||
14 | - | | |
15 | - | | |
16 | - | | |
17 | - | | |
18 | - | | |
19 | - | | |
12 | + | func getNbPresence () = { | |
13 | + | let nbPresence = getInteger(presenceKey) | |
14 | + | match nbPresence { | |
15 | + | case t: Int => | |
16 | + | t | |
17 | + | case _ => | |
18 | + | 0 | |
19 | + | } | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | ||
23 | - | func testValid (e) = { | |
24 | - | let studentAddress = addressFromStringValue(take(e, 35)) | |
25 | - | let studentStatus = takeRight(e, (size(e) - 36)) | |
26 | - | let res = invoke(studentAddress, "validationPresence", [studentStatus, getStringValue(nodeValidatrice)], nil) | |
27 | - | if ((res == res)) | |
28 | - | then unit | |
29 | - | else throw("Strict value is not equal to itself.") | |
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 | + | } | |
30 | 42 | } | |
31 | 43 | ||
32 | 44 | ||
33 | 45 | @Callable(i) | |
34 | - | func createOrModifyClass (nom,eleves) = [StringEntry(getClassName(nom, i.caller), eleves)] | |
35 | - | ||
36 | - | ||
37 | - | ||
38 | - | @Callable(i) | |
39 | - | func deleteClass (nom) = [DeleteEntry(getClassName(nom, i.caller))] | |
40 | - | ||
41 | - | ||
42 | - | ||
43 | - | @Callable(i) | |
44 | - | func ajouterValidateur (address) = [StringEntry(nodeValidatrice, address)] | |
45 | - | ||
46 | - | ||
47 | - | ||
48 | - | @Callable(i) | |
49 | - | func faireAppel (classe,eleves) = { | |
50 | - | let leasedEtudiants = { | |
51 | - | let $l = eleves | |
52 | - | let $s = size($l) | |
53 | - | let $acc0 = nil | |
54 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
55 | - | then $a | |
56 | - | else validerEleve($a, $l[$i]) | |
57 | - | ||
58 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
59 | - | then $a | |
60 | - | else throw("List size exceeds 30") | |
61 | - | ||
62 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30) | |
63 | - | } | |
64 | - | [StringEntry(classeEnCours, getClassName(classe, i.caller)), BooleanEntry(estEnCours, true)] | |
46 | + | func validationPresence (presence,addressToLease) = { | |
47 | + | let nbPresence = getNbPresence() | |
48 | + | let nbCours = getNbCours() | |
49 | + | let nbAbsence = getNbAbsence() | |
50 | + | if ((presence == "présent")) | |
51 | + | then { | |
52 | + | let leasableBalance = (wavesBalance(this).available - 100000) | |
53 | + | let lease = Lease(addressFromStringValue(addressToLease), leasableBalance) | |
54 | + | let leaseId = calculateLeaseId(lease) | |
55 | + | [IntegerEntry(presenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1)), BinaryEntry(leaseIdKey, leaseId), IntegerEntry("balance", leasableBalance)] | |
56 | + | } | |
57 | + | else [IntegerEntry(absenceKey, (nbPresence + 1)), IntegerEntry(totalCours, (nbCours + 1)), LeaseCancel(getBinaryValue(leaseIdKey))] | |
65 | 58 | } | |
66 | - | ||
67 | - | ||
68 | - | ||
69 | - | @Callable(i) | |
70 | - | func faireAppelEleve () = { | |
71 | - | let eleve = testValid("3N7at66kMSR66wPkY8pvnAcRg711XKkRmW7_présent") | |
72 | - | [IntegerEntry("balance_available", wavesBalance(this).available)] | |
73 | - | } | |
74 | - | ||
75 | - | ||
76 | - | ||
77 | - | @Callable(i) | |
78 | - | func arreterCours () = [StringEntry(classeEnCours, ""), BooleanEntry(estEnCours, false)] | |
79 | 59 | ||
80 | 60 |
github/deemru/w8io/169f3d6 56.40 ms ◑