tx · 2Y7vkHLcL6q9YzTKdTQ9KxYfXvqWUiSouLyU5eHrzn8s

3MrdV3AP4zfU77ifesNStoDZmL1Cfx13eDc:  -0.01000000 Waves

2019.12.17 16:38 [812982] smart account 3MrdV3AP4zfU77ifesNStoDZmL1Cfx13eDc > SELF 0.00000000 Waves

{ "type": 13, "id": "2Y7vkHLcL6q9YzTKdTQ9KxYfXvqWUiSouLyU5eHrzn8s", "fee": 1000000, "feeAssetId": null, "timestamp": 1576589811917, "version": 1, "sender": "3MrdV3AP4zfU77ifesNStoDZmL1Cfx13eDc", "senderPublicKey": "5M79Anear5ntQk2bbDdFA2goiPXkv7Xy2UpV4n5RKRv", "proofs": [ "5UBRcHpCxBHZe5QtF9RRskp9g7Kz8az6BXkYAq656LueC9JGcGQVTTf4gRqD9FXttUeHzXxMaMuMta1y3shTH4x3" ], "script": "base64:AAIDAAAAAAAAAAoIARIAEgQKAgEIAAAACAAAAAASV0JFVFJFU0VSVkFUSU9OS0VZAgAAABUkV0JFVF9SRVNFUlZFRF9BTU9VTlQAAAAAE1JPWUFMUkVTRVJWQVRJT05LRVkCAAAAFiRST1lBTF9SRVNFUlZFRF9BTU9VTlQAAAAABFdCRVQBAAAAIIa0Nqh40w7M2PAXrUsuLAQfB5+6yrkWqUrXbyWtm9B2AAAAAAVST1lBTAEAAAAgQ+mKgsIl2XSclXwgUknGo5qQsraVX2JiXso4iYkMaRwBAAAAFkV4dHJhY3RXQkVUUmVzZXJ2ZWRBbXQAAAAABAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAEldCRVRSRVNFUlZBVElPTktFWQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAQAAABdFeHRyYWN0Uk9ZQUxSZXNlcnZlZEFtdAAAAAAEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAATUk9ZQUxSRVNFUlZBVElPTktFWQ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lcnZlZEFtb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAGd2FsbGV0CQEAAAATRm9ybWF0UGxheWVyQmFsYW5jZQAAAAIFAAAAE25ld1BsYXllcldCRVRBbW91bnQFAAAAC3JveWFsQW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAMJAAAAAAAAAgUAAAAFYXNzZXQCAAAABVJPWUFMAwkAAGYAAAACBQAAAAZhbW91bnQFAAAAC3JveWFsQW1vdW50CQAAAgAAAAECAAAAPllvdSBkb250IGhhdmUgZW5vdWdoIGJhbGFuY2UgdG8gd2l0aGRyYXcgdGhlIGFtb3VudCByZXF1ZXN0ZWQuBAAAABVuZXdXQkVUUmVzZXJ2ZWRBbW91bnQJAABlAAAAAgkBAAAAFkV4dHJhY3RXQkVUUmVzZXJ2ZWRBbXQAAAAACAUAAAAHcGF5bWVudAAAAAZhbW91bnQEAAAAE25ld1BsYXllcldCRVRBbW91bnQJAABlAAAAAgUAAAAKd2JldEFtb3VudAgFAAAAB3BheW1lbnQAAAAGYW1vdW50CQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAASV0JFVFJFU0VSVkFUSU9OS0VZBQAAABVuZXdXQkVUUmVzZXJ2ZWRBbW91bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAABndhbGxldAkBAAAAE0Zvcm1hdFBsYXllckJhbGFuY2UAAAACBQAAABNuZXdQbGF5ZXJXQkVUQW1vdW50BQAAAAtyb3lhbEFtb3VudAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABBQAAAANuaWwJAAACAAAAAQIAAAANaW52YWxpdCBhc3NldAAAAACmVViP", "chainId": 84, "height": 812982, "spentComplexity": 0 } View: original | compacted Prev: none Next: 7pXoo3jJYSPViuvNza3dnFPmnkDAbYEnGa23tPWxaS1e Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let WBETRESERVATIONKEY = "$WBET_RESERVED_AMOUNT"
5+
6+let ROYALRESERVATIONKEY = "$ROYAL_RESERVED_AMOUNT"
7+
8+let WBET = base58'A4q1mYKo11yuH9gmvDodeJoksagcyQzeFE9JtphMWddw'
9+
10+let ROYAL = base58'5a6rvDEiVwvhTvTH6ce2qFwqdCt3VKaHKXEpwLXXVvyy'
11+
12+func ExtractWBETReservedAmt () = match getInteger(this, WBETRESERVATIONKEY) {
13+ case a: Int =>
14+ a
15+ case _ =>
16+ 0
17+}
18+
19+
20+func ExtractROYALReservedAmt () = match getInteger(this, ROYALRESERVATIONKEY) {
21+ case a: Int =>
22+ a
23+ case _ =>
24+ 0
25+}
26+
27+
28+func ExtractPlayerAmt (wallet) = match getString(this, wallet) {
29+ case str: String =>
30+ str
31+ case _ =>
32+ "0_0"
33+}
34+
35+
36+func FormatPlayerBalance (wbet,royal) = ((toString(wbet) + "_") + toString(royal))
37+
38+
39+@Callable(i)
40+func lock () = {
41+ let payment = extract(i.payment)
42+ if (if ((payment.assetId != WBET))
43+ then true
44+ else (payment.assetId != ROYAL))
45+ then throw("Token should be WBET or ROYAL.")
46+ else {
47+ let wallet = toString(i.caller)
48+ let playerAmount = split(ExtractPlayerAmt(wallet), "_")
49+ let wbetAmount = parseIntValue(playerAmount[0])
50+ let royalAmount = parseIntValue(playerAmount[1])
51+ if ((payment.assetId == WBET))
52+ then {
53+ let newWBETReservedAmount = (ExtractWBETReservedAmt() + payment.amount)
54+ let newPlayerWBETAmount = (wbetAmount + payment.amount)
55+ ScriptResult(WriteSet([DataEntry(WBETRESERVATIONKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(newPlayerWBETAmount, royalAmount))]), TransferSet(nil))
56+ }
57+ else if ((payment.assetId == ROYAL))
58+ then {
59+ let newROYALReservedAmount = (ExtractROYALReservedAmt() + payment.amount)
60+ let newPlayerRoyalAmount = (royalAmount + payment.amount)
61+ ScriptResult(WriteSet([DataEntry(ROYALRESERVATIONKEY, newROYALReservedAmount), DataEntry(wallet, FormatPlayerBalance(wbetAmount, newPlayerRoyalAmount))]), TransferSet(nil))
62+ }
63+ else throw("error")
64+ }
65+ }
66+
67+
68+
69+@Callable(i)
70+func unlock (amount,asset) = {
71+ let wallet = toString(i.caller)
72+ let payment = extract(i.payment)
73+ let playerAmount = split(ExtractPlayerAmt(wallet), "_")
74+ let wbetAmount = parseIntValue(playerAmount[0])
75+ let royalAmount = parseIntValue(playerAmount[1])
76+ if ((asset == "WBET"))
77+ then if ((amount > wbetAmount))
78+ then throw("You dont have enough balance to withdraw the amount requested.")
79+ else {
80+ let newWBETReservedAmount = (ExtractWBETReservedAmt() - payment.amount)
81+ let newPlayerWBETAmount = (wbetAmount - payment.amount)
82+ ScriptResult(WriteSet([DataEntry(WBETRESERVATIONKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(newPlayerWBETAmount, royalAmount))]), TransferSet(nil))
83+ }
84+ else if ((asset == "ROYAL"))
85+ then if ((amount > royalAmount))
86+ then throw("You dont have enough balance to withdraw the amount requested.")
87+ else {
88+ let newWBETReservedAmount = (ExtractWBETReservedAmt() - payment.amount)
89+ let newPlayerWBETAmount = (wbetAmount - payment.amount)
90+ ScriptResult(WriteSet([DataEntry(WBETRESERVATIONKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(newPlayerWBETAmount, royalAmount))]), TransferSet(nil))
91+ }
92+ else throw("invalit asset")
93+ }
94+
95+

github/deemru/w8io/026f985 
16.62 ms