tx · Bk8x4497kZb54QMJmrgwRpXcTzCp2iKVJFvw8C93NcT7

3MvUPcLYNFkmNzkA2h8jVU1fVK416VCT3hR:  -0.01000000 Waves

2022.10.17 15:44 [2276393] smart account 3MvUPcLYNFkmNzkA2h8jVU1fVK416VCT3hR > SELF 0.00000000 Waves

{ "type": 13, "id": "Bk8x4497kZb54QMJmrgwRpXcTzCp2iKVJFvw8C93NcT7", "fee": 1000000, "feeAssetId": null, "timestamp": 1666010505667, "version": 2, "chainId": 84, "sender": "3MvUPcLYNFkmNzkA2h8jVU1fVK416VCT3hR", "senderPublicKey": "GjnhUMpwQus4JiztKNVi1bLKtwBS2UT3YpxVyqsYB4KG", "proofs": [ "4mHUuu7nAZTBgt9Pt7pemgTJihdJs237HRV5MHhXqaNmDc3UZdwRRsPRJ9MeBQvUgn3NZbPLQ4JK85yYNyiexgVj" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAAAAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10AwkAAAAAAAACCQABkAAAAAEIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAACQAAAgAAAAECAAAAHEF0dGFjaGVkIHBheW1lbnQgaXMgcmVxdWlyZWQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAFXdvcmtzIHdpdGggd2F2ZXMgb25seQQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW1vdW50CQAAZAAAAAIFAAAADWN1cnJlbnRBbW91bnQIBQAAAANwbXQAAAAGYW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAApjdXJyZW50S2V5BQAAAAluZXdBbW91bnQFAAAAA25pbAAAAAFpAQAAAAh3aXRoZHJhdwAAAAEAAAAGYW1vdW50BAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABlAAAAAgUAAAANY3VycmVudEFtb3VudAUAAAAGYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAZhbW91bnQJAAACAAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAluZXdBbW91bnQJAAACAAAAAQIAAAASTm90IGVub3VnaCBiYWxhbmNlCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAApjdXJyZW50S2V5BQAAAAluZXdBbW91bnQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABHVuaXQFAAAAA25pbAAAAADDfE8l", "height": 2276393, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3r8CcxPkf2XXMtY19EjkHe71jAJwdPAef7RAGWPruua9 Next: BGyxbz3LakMbtVWoupUhJ5qPMvZ3iH3xAGvYNYBY687w Full:
OldNewDifferences
1-{-# STDLIB_VERSION 3 #-}
1+{-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
7-func updateInfos (name,intro) = {
8- let ownerAddress = i.caller
9- WriteSet([DataEntry((toString(ownerAddress) + "_name"), name), DataEntry((toString(ownerAddress) + "_intro"), intro)])
7+func deposit () = {
8+ let pmt = if ((size(i.payments) == 1))
9+ then i.payments[0]
10+ else throw("Attached payment is required")
11+ if (isDefined(pmt.assetId))
12+ then throw("works with waves only")
13+ else {
14+ let currentKey = toBase58String(i.caller.bytes)
15+ let currentAmount = match getInteger(this, currentKey) {
16+ case a: Int =>
17+ a
18+ case _ =>
19+ 0
20+ }
21+ let newAmount = (currentAmount + pmt.amount)
22+[IntegerEntry(currentKey, newAmount)]
23+ }
1024 }
1125
1226
1327
1428 @Callable(i)
15-func addUpdateCase (identifiant,gender,age,location,pec,status,date) = {
16- let ownerAddress = toString(i.caller)
17- let currentCounterNum = match getInteger(this, (ownerAddress + "_counterNum")) {
18- case c: Int =>
19- c
29+func withdraw (amount) = {
30+ let currentKey = toBase58String(i.caller.bytes)
31+ let currentAmount = match getInteger(this, currentKey) {
32+ case a: Int =>
33+ a
2034 case _ =>
2135 0
2236 }
23- let patientID = match getInteger(this, (((ownerAddress + "_patient_") + toString(identifiant)) + "_identifiant")) {
24- case p: Int =>
25- p
26- case _ =>
27- (currentCounterNum + 1)
28- }
29- let updateCounter = if ((identifiant == 0))
30- then (currentCounterNum + 1)
31- else currentCounterNum
32- if (if (if ((status != 1))
33- then (status != 2)
34- else false)
35- then (status != 3)
36- else false)
37- then throw("Wrong status")
38- else WriteSet([DataEntry((((ownerAddress + "_patient_") + toString(patientID)) + "_identifiant"), patientID), DataEntry((((ownerAddress + "_patient_") + toString(patientID)) + "_gender"), gender), DataEntry((((ownerAddress + "_patient_") + toString(patientID)) + "_age"), age), DataEntry((((ownerAddress + "_patient_") + toString(patientID)) + "_pec"), pec), DataEntry((((ownerAddress + "_patient_") + toString(patientID)) + "_location"), location), DataEntry((((ownerAddress + "_patient_") + toString(patientID)) + "_status"), status), DataEntry((((ownerAddress + "_patient_") + toString(patientID)) + "_date"), date), DataEntry((ownerAddress + "_counterNum"), updateCounter)])
37+ let newAmount = (currentAmount - amount)
38+ if ((0 > amount))
39+ then throw("Can't withdraw negative amount")
40+ else if ((0 > newAmount))
41+ then throw("Not enough balance")
42+ else [IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)]
3943 }
4044
4145

github/deemru/w8io/026f985 
23.95 ms