tx · 7p2nd2GTxzJ3wckcWQsqw82V1nbN9kUf5AYgj6MZg8ak

3MqxFhe869ri22Y1418TcrXUX2X9YMzG2Yb:  -0.01400000 Waves

2019.06.28 20:35 [562288] smart account 3MqxFhe869ri22Y1418TcrXUX2X9YMzG2Yb > SELF 0.00000000 Waves

{ "type": 13, "id": "7p2nd2GTxzJ3wckcWQsqw82V1nbN9kUf5AYgj6MZg8ak", "fee": 1400000, "feeAssetId": null, "timestamp": 1561743405319, "version": 1, "sender": "3MqxFhe869ri22Y1418TcrXUX2X9YMzG2Yb", "senderPublicKey": "FRkBvFhV1T95mPTxp7sk2Ms2BuHViwyG7yPzxpxye1Kw", "proofs": [ "5RFzmntzH4nzUKzdEJFQBh9WHnmnRVhcpKA9C8yPRacXKTowpibvndWqg3J8Gu7SMKMBo273Ud7F17PckPQu4raP" ], "script": "base64:AAIDAAAAAAAAAAAAAAALAAAAAApzZXJ2aWNlRmVlAAAAAAAAmJaAAAAAAAVlbXB0eQIAAAAETlVMTAAAAAASYWxsTWVzc2FnZUJvYXJkS2V5AgAAAAthbGxfbWVzc2FnZQAAAAAQYWN0aXZlTWVzc2FnZUtleQIAAAAOYWN0aXZlX21lc3NhZ2UAAAAADmVhcm5lZFdhdmVzS2V5AgAAAAtlYXJuZWRXYXZlcwAAAAANc2VydmljZUZlZUtleQIAAAAKc2VydmljZUZlZQAAAAAJZEFwcE93bmVyAgAAACMzTXZpS2U4dnlibmtZdUo4M2U4UVZTV1ExVkh5ZmdwaUYzVwEAAAAJdW5pcXVlS2V5AAAAAgAAAAVvd25lcgAAAAR0ZXh0BAAAAAR1S2V5CQACWAAAAAEJAAH3AAAAAQkAAZsAAAABCQABLAAAAAIFAAAABW93bmVyBQAAAAR0ZXh0BQAAAAR1S2V5AQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0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SBkaWRuJ3QgZm91bmQDCQEAAAACIT0AAAACBQAAAAVvd25lcgUAAAANc2VuZGVyQWRkcmVzcwkAAAIAAAABCQABLAAAAAICAAAAG1lvdSBkb24ndCBvd25lciBvZiBtZXNzYWdlIAUAAAAEdUtleQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAQYWN0aXZlTWVzc2FnZUtleQkAAGUAAAACBQAAAAphY3RNZXNzYWdlAAAAAAAAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAACG1lc3NhZ2VfBQAAAAR1S2V5AgAAAAkjUkVNT1ZFRCMFAAAAA25pbAAAAAFpAQAAAA1zZXRTZXJ2aWNlRmVlAAAAAQAAAAZuZXdGZWUEAAAADXNlbmRlckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMJAQAAAAIhPQAAAAIFAAAADXNlbmRlckFkZHJlc3MFAAAACWRBcHBPd25lcgkAAAIAAAABAgAAABpZb3UgYXJlbid0IG93bmVyIHRoaXMgZEFwcAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAANc2VydmljZUZlZUtleQUAAAAGbmV3RmVlBQAAAANuaWwAAAAAA7Amyw==", "chainId": 84, "height": 562288, "spentComplexity": 0 } View: original | compacted Prev: EKh4Paqbr7R9syVTqKHRh3za72M7eBG7rTDrQwheuFbv Next: Bo8FsrnwbVoY8YX22459tGpgvw8Dwj3tXAw4KU2qieKh Diff:
OldNewDifferences
1010 let activeMessageKey = "active_message"
1111
1212 let earnedWavesKey = "earnedWaves"
13+
14+let serviceFeeKey = "serviceFee"
15+
16+let dAppOwner = "3MviKe8vybnkYuJ83e8QVSWQ1VHyfgpiF3W"
1317
1418 func uniqueKey (owner,text) = {
1519 let uKey = toBase58String(sha256(toBytes((owner + text))))
3943 }
4044
4145
46+func getSeviceFee () = {
47+ let fee = match getInteger(this, serviceFeeKey) {
48+ case a: Int =>
49+ a
50+ case _ =>
51+ serviceFee
52+ }
53+ fee
54+ }
55+
56+
4257 @Callable(i)
4358 func setMessage (text) = {
4459 let pmt = extract(i.payment)
60+ let lFee = getSeviceFee()
4561 if (isDefined(pmt.assetId))
4662 then throw("WAVES token only at the moment")
47- else if ((pmt.amount != serviceFee))
48- then throw("You need pay 0.1 WAVES")
63+ else if ((pmt.amount != lFee))
64+ then throw("Wrong service fee amount")
4965 else {
5066 let ownerAddress = toBase58String(i.caller.bytes)
5167 let uKey = uniqueKey(ownerAddress, text)
7288 }
7389
7490
91+
92+@Callable(i)
93+func setServiceFee (newFee) = {
94+ let senderAddress = toBase58String(i.caller.bytes)
95+ if ((senderAddress != dAppOwner))
96+ then throw("You aren't owner this dApp")
97+ else WriteSet([DataEntry(serviceFeeKey, newFee)])
98+ }
99+
100+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let serviceFee = 10000000
55
66 let empty = "NULL"
77
88 let allMessageBoardKey = "all_message"
99
1010 let activeMessageKey = "active_message"
1111
1212 let earnedWavesKey = "earnedWaves"
13+
14+let serviceFeeKey = "serviceFee"
15+
16+let dAppOwner = "3MviKe8vybnkYuJ83e8QVSWQ1VHyfgpiF3W"
1317
1418 func uniqueKey (owner,text) = {
1519 let uKey = toBase58String(sha256(toBytes((owner + text))))
1620 uKey
1721 }
1822
1923
2024 func getNumberByKey (key) = {
2125 let num = match getInteger(this, key) {
2226 case a: Int =>
2327 a
2428 case _ =>
2529 0
2630 }
2731 num
2832 }
2933
3034
3135 func getStrByKey (key) = {
3236 let str = match getString(this, key) {
3337 case a: String =>
3438 a
3539 case _ =>
3640 empty
3741 }
3842 str
3943 }
4044
4145
46+func getSeviceFee () = {
47+ let fee = match getInteger(this, serviceFeeKey) {
48+ case a: Int =>
49+ a
50+ case _ =>
51+ serviceFee
52+ }
53+ fee
54+ }
55+
56+
4257 @Callable(i)
4358 func setMessage (text) = {
4459 let pmt = extract(i.payment)
60+ let lFee = getSeviceFee()
4561 if (isDefined(pmt.assetId))
4662 then throw("WAVES token only at the moment")
47- else if ((pmt.amount != serviceFee))
48- then throw("You need pay 0.1 WAVES")
63+ else if ((pmt.amount != lFee))
64+ then throw("Wrong service fee amount")
4965 else {
5066 let ownerAddress = toBase58String(i.caller.bytes)
5167 let uKey = uniqueKey(ownerAddress, text)
5268 let allMessage = getNumberByKey(allMessageBoardKey)
5369 let actMessage = getNumberByKey(activeMessageKey)
5470 let earnedWaves = getNumberByKey(earnedWavesKey)
5571 WriteSet([DataEntry(("owner_" + uKey), ownerAddress), DataEntry(("message_" + uKey), text), DataEntry(allMessageBoardKey, (allMessage + 1)), DataEntry(activeMessageKey, (actMessage + 1)), DataEntry(earnedWavesKey, (earnedWaves + serviceFee))])
5672 }
5773 }
5874
5975
6076
6177 @Callable(i)
6278 func removeMessage (uKey) = {
6379 let pmt = extract(i.payment)
6480 let owner = getStrByKey(("owner_" + uKey))
6581 let actMessage = getNumberByKey(activeMessageKey)
6682 let senderAddress = toBase58String(i.caller.bytes)
6783 if ((owner == empty))
6884 then throw("Message didn't found")
6985 else if ((owner != senderAddress))
7086 then throw(("You don't owner of message " + uKey))
7187 else WriteSet([DataEntry(activeMessageKey, (actMessage - 1)), DataEntry(("message_" + uKey), "#REMOVED#")])
7288 }
7389
7490
91+
92+@Callable(i)
93+func setServiceFee (newFee) = {
94+ let senderAddress = toBase58String(i.caller.bytes)
95+ if ((senderAddress != dAppOwner))
96+ then throw("You aren't owner this dApp")
97+ else WriteSet([DataEntry(serviceFeeKey, newFee)])
98+ }
99+
100+

github/deemru/w8io/169f3d6 
33.66 ms