tx · 7gRztxkZaKTqJm8pFZUPcP6NUv3o8ryid1S86FYX1eci 3MzfaHTFgjznN8zniycq5PZxaenTjwcYLXf: -0.01000000 Waves 2022.01.30 03:47 [1900971] smart account 3MzfaHTFgjznN8zniycq5PZxaenTjwcYLXf > SELF 0.00000000 Waves
{ "type": 13, "id": "7gRztxkZaKTqJm8pFZUPcP6NUv3o8ryid1S86FYX1eci", "fee": 1000000, "feeAssetId": null, "timestamp": 1643503665465, "version": 2, "chainId": 84, "sender": "3MzfaHTFgjznN8zniycq5PZxaenTjwcYLXf", "senderPublicKey": "5ate1da9rhtGuHpuEAd28pTGh1GpM8SUthHy4JD2hPeL", "proofs": [ "4QFKTutVkWbbdCtncBQBv8TxFYVGaLN4VisSzR1N9mcRVy11GADy5t6vs9j96CBgEwS6V2HNp2XnTf6QZbkFuAua" ], "script": "base64:AAIFAAAAAAAAAYwIAhIECgIICBIDCgEIEgQKAggYEgAaCwoBQRIGdmVyaWZ5Gg8KAWESCmVzdEVuQ291cnMaEgoBYhINY2xhc3NlRW5Db3VycxoRCgFjEgxnZXRDbGFzc05hbWUaCAoBZBIDbm9tGg8KAWUSCnByb2Zlc3NldXIaFQoBZhIQY2FuRXR1ZGlhbnRMZWFzZRoMCgFnEgdhZHJlc3NlGgwKAWgSB2JhbGFuY2UaEQoBaRIMdmFsaWRlckVsZXZlGggKAWoSA2FjYxoGCgFrEgFlGhMKAWwSDnN0dWRlbnRBZGRyZXNzGhIKAW0SDXN0dWRlbnRTdGF0dXMaBgoBbhIBaRoLCgFvEgZlbGV2ZXMaCwoBcBIGY2xhc3NlGhQKAXESD2xlYXNlZEV0dWRpYW50cxoHCgFyEgIkbBoHCgFzEgIkcxoKCgF0EgUkYWNjMBoKCgF1EgUkZjBfMRoHCgF2EgIkYRoHCgF3EgIkaRoKCgF4EgUkZjBfMhoLCgF5EgZyZXR1cm4aBwoBehICdHgAAAAFAAAAAAFhAgAAAAplc3RFbkNvdXJzAAAAAAFiAgAAAAABAAAAA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FAAAAAWEGBQAAAAF5AAAAAW4BAAAADGFycmV0ZXJDb3VycwAAAAAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgUAAAABYgIAAAAACQAETAAAAAIJAQAAAAxCb29sZWFuRW50cnkAAAACBQAAAAFhBwUAAAADbmlsAAAAAQAAAAF6AQAAAAFBAAAAAAZeNKrt", "height": 1900971, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5T4opJD5jFchnuPh9uuQ4pTFYKx5d2RSHxSNRwbPhws Next: CZ7cxcEkLnRnDmzG2tP5u19zpkmV8WzSia3oYypPhjBP Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let estEnCours = "estEnCours" | |
5 | + | ||
6 | + | let classeEnCours = "" | |
7 | + | ||
8 | + | func getClassName (nom,professeur) = ((nom + "_") + toString(professeur)) | |
9 | + | ||
10 | + | ||
11 | + | func canEtudiantLease (adresse) = { | |
12 | + | let balance = wavesBalance(adresse) | |
13 | + | if ((balance.available > 0)) | |
14 | + | then true | |
15 | + | else false | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | func validerEleve (acc,e) = { | |
20 | + | let studentAddress = Address(fromBase58String(take(e, 35))) | |
21 | + | let studentStatus = takeRight(e, (size(e) - 34)) | |
22 | + | if (if (canEtudiantLease(studentAddress)) | |
23 | + | then if ((studentStatus == "Retard")) | |
24 | + | then true | |
25 | + | else (studentStatus == "Present") | |
26 | + | else false) | |
27 | + | then Lease(studentAddress, wavesBalance(studentAddress).available) | |
28 | + | else unit | |
29 | + | } | |
4 | 30 | ||
5 | 31 | ||
6 | 32 | @Callable(i) | |
7 | - | func createOrModifyClass (nom,eleves) = [StringEntry( | |
33 | + | func createOrModifyClass (nom,eleves) = [StringEntry(getClassName(nom, i.caller), eleves)] | |
8 | 34 | ||
9 | 35 | ||
10 | 36 | ||
11 | 37 | @Callable(i) | |
12 | - | func deleteClass (nom) = [DeleteEntry( | |
38 | + | func deleteClass (nom) = [DeleteEntry(getClassName(nom, i.caller))] | |
13 | 39 | ||
14 | 40 | ||
15 | 41 | ||
16 | 42 | @Callable(i) | |
17 | - | func test () = [StringEntry("Test", "test réussi")] | |
43 | + | func faireAppel (classe,eleves) = { | |
44 | + | let leasedEtudiants = { | |
45 | + | let $l = eleves | |
46 | + | let $s = size($l) | |
47 | + | let $acc0 = nil | |
48 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
49 | + | then $a | |
50 | + | else validerEleve($a, $l[$i]) | |
51 | + | ||
52 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
53 | + | then $a | |
54 | + | else throw("List size exceeds 30") | |
55 | + | ||
56 | + | $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) | |
57 | + | } | |
58 | + | let return = ((leasedEtudiants :+ StringEntry(classeEnCours, getClassName(classe, i.caller))) :+ BooleanEntry(estEnCours, true)) | |
59 | + | return | |
60 | + | } | |
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | @Callable(i) | |
65 | + | func arreterCours () = [StringEntry(classeEnCours, ""), BooleanEntry(estEnCours, false)] | |
18 | 66 | ||
19 | 67 | ||
20 | 68 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let estEnCours = "estEnCours" | |
5 | + | ||
6 | + | let classeEnCours = "" | |
7 | + | ||
8 | + | func getClassName (nom,professeur) = ((nom + "_") + toString(professeur)) | |
9 | + | ||
10 | + | ||
11 | + | func canEtudiantLease (adresse) = { | |
12 | + | let balance = wavesBalance(adresse) | |
13 | + | if ((balance.available > 0)) | |
14 | + | then true | |
15 | + | else false | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | func validerEleve (acc,e) = { | |
20 | + | let studentAddress = Address(fromBase58String(take(e, 35))) | |
21 | + | let studentStatus = takeRight(e, (size(e) - 34)) | |
22 | + | if (if (canEtudiantLease(studentAddress)) | |
23 | + | then if ((studentStatus == "Retard")) | |
24 | + | then true | |
25 | + | else (studentStatus == "Present") | |
26 | + | else false) | |
27 | + | then Lease(studentAddress, wavesBalance(studentAddress).available) | |
28 | + | else unit | |
29 | + | } | |
4 | 30 | ||
5 | 31 | ||
6 | 32 | @Callable(i) | |
7 | - | func createOrModifyClass (nom,eleves) = [StringEntry( | |
33 | + | func createOrModifyClass (nom,eleves) = [StringEntry(getClassName(nom, i.caller), eleves)] | |
8 | 34 | ||
9 | 35 | ||
10 | 36 | ||
11 | 37 | @Callable(i) | |
12 | - | func deleteClass (nom) = [DeleteEntry( | |
38 | + | func deleteClass (nom) = [DeleteEntry(getClassName(nom, i.caller))] | |
13 | 39 | ||
14 | 40 | ||
15 | 41 | ||
16 | 42 | @Callable(i) | |
17 | - | func test () = [StringEntry("Test", "test réussi")] | |
43 | + | func faireAppel (classe,eleves) = { | |
44 | + | let leasedEtudiants = { | |
45 | + | let $l = eleves | |
46 | + | let $s = size($l) | |
47 | + | let $acc0 = nil | |
48 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
49 | + | then $a | |
50 | + | else validerEleve($a, $l[$i]) | |
51 | + | ||
52 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
53 | + | then $a | |
54 | + | else throw("List size exceeds 30") | |
55 | + | ||
56 | + | $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) | |
57 | + | } | |
58 | + | let return = ((leasedEtudiants :+ StringEntry(classeEnCours, getClassName(classe, i.caller))) :+ BooleanEntry(estEnCours, true)) | |
59 | + | return | |
60 | + | } | |
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | @Callable(i) | |
65 | + | func arreterCours () = [StringEntry(classeEnCours, ""), BooleanEntry(estEnCours, false)] | |
18 | 66 | ||
19 | 67 | ||
20 | 68 | @Verifier(tx) | |
21 | 69 | func verify () = true | |
22 | 70 |
github/deemru/w8io/169f3d6 27.17 ms ◑