tx · FFdkm8c4aYMyHyycA8YtXpQ98QZeQtN2NppBq8bia24B 3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX: -0.05000000 Waves 2019.10.30 14:08 [742799] smart account 3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX > SELF 0.00000000 Waves
{ "type": 13, "id": "FFdkm8c4aYMyHyycA8YtXpQ98QZeQtN2NppBq8bia24B", "fee": 5000000, "feeAssetId": null, "timestamp": 1572433804882, "version": 1, "sender": "3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX", "senderPublicKey": "ACfUG5PwG2GssMuyEwVEhkYAbbbP1geSHR8XoNxLyu6V", "proofs": [ "2mg2MNzaMQScybPvBeyTfqTBvqBLzZ2cFFxyWABzDSw3rPLPNicZEzqvHhpeCm87ws9LsAi7Lmn4iMh9J9NPgFC2" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAEAAAAAA5SRVNFUlZBVElPTktFWQIAAAAVJFdCRVRfUkVTRVJWRURfQU1PVU5UAAAAAARXQkVUAQAAAAQTq9kzAQAAABJFeHRyYWN0UmVzZXJ2ZWRBbXQAAAAABAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAADlJFU0VSVkFUSU9OS0VZAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAAEEV4dHJhY3RQbGF5ZXJBbXQAAAABAAAABndhbGxldAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAAZ3YWxsZXQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAB3BheW1lbnQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAGd2FsbGV0CQAEJQAAAAEIBQAAAAFp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ACBQAAAA5SRVNFUlZBVElPTktFWQUAAAARbmV3UmVzZXJ2ZWRBbW91bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAABndhbGxldAUAAAAPbmV3UGxheWVyQW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABFdCRVQFAAAAA25pbAAAAACb4IPW", "chainId": 84, "height": 742799, "spentComplexity": 0 } View: original | compacted Prev: EbZsck9ofC6chtUBMqNUduEHB5L7feHPrWnYfaUwfVpN Next: 7W8E8JzrLkUesMfwsS9EVCkA74PU67vdh5TJ2kh9k7Nb Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let RESERVATIONKEY = "$RESERVED_AMOUNT" | |
4 | + | let RESERVATIONKEY = "$WBET_RESERVED_AMOUNT" | |
5 | 5 | ||
6 | - | let WBET = base58' | |
6 | + | let WBET = base58'WAVES' | |
7 | 7 | ||
8 | 8 | func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) { | |
9 | 9 | case a: Int => | |
24 | 24 | @Callable(i) | |
25 | 25 | func deposit () = { | |
26 | 26 | let payment = extract(i.payment) | |
27 | - | if ((payment.assetId != WBET)) | |
28 | - | then throw("Payment should be in Wbet.") | |
29 | - | else { | |
30 | - | let wallet = toString(i.caller) | |
31 | - | let newPlayerAmount = (ExtractPlayerAmt(wallet) + payment.amount) | |
32 | - | let newReservedAmount = (ExtractReservedAmt() + payment.amount) | |
33 | - | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY, newReservedAmount), DataEntry(wallet, newPlayerAmount)]), TransferSet(nil)) | |
34 | - | } | |
27 | + | let wallet = toString(i.caller) | |
28 | + | let newPlayerAmount = (ExtractPlayerAmt(wallet) + payment.amount) | |
29 | + | let newReservedAmount = (ExtractReservedAmt() + payment.amount) | |
30 | + | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY, newReservedAmount), DataEntry(wallet, newPlayerAmount)]), TransferSet(nil)) | |
35 | 31 | } | |
36 | 32 | ||
37 | 33 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let RESERVATIONKEY = "$RESERVED_AMOUNT" | |
4 | + | let RESERVATIONKEY = "$WBET_RESERVED_AMOUNT" | |
5 | 5 | ||
6 | - | let WBET = base58' | |
6 | + | let WBET = base58'WAVES' | |
7 | 7 | ||
8 | 8 | func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) { | |
9 | 9 | case a: Int => | |
10 | 10 | a | |
11 | 11 | case _ => | |
12 | 12 | 0 | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func ExtractPlayerAmt (wallet) = match getInteger(this, wallet) { | |
17 | 17 | case a: Int => | |
18 | 18 | a | |
19 | 19 | case _ => | |
20 | 20 | 0 | |
21 | 21 | } | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | 25 | func deposit () = { | |
26 | 26 | let payment = extract(i.payment) | |
27 | - | if ((payment.assetId != WBET)) | |
28 | - | then throw("Payment should be in Wbet.") | |
29 | - | else { | |
30 | - | let wallet = toString(i.caller) | |
31 | - | let newPlayerAmount = (ExtractPlayerAmt(wallet) + payment.amount) | |
32 | - | let newReservedAmount = (ExtractReservedAmt() + payment.amount) | |
33 | - | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY, newReservedAmount), DataEntry(wallet, newPlayerAmount)]), TransferSet(nil)) | |
34 | - | } | |
27 | + | let wallet = toString(i.caller) | |
28 | + | let newPlayerAmount = (ExtractPlayerAmt(wallet) + payment.amount) | |
29 | + | let newReservedAmount = (ExtractReservedAmt() + payment.amount) | |
30 | + | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY, newReservedAmount), DataEntry(wallet, newPlayerAmount)]), TransferSet(nil)) | |
35 | 31 | } | |
36 | 32 | ||
37 | 33 | ||
38 | 34 | ||
39 | 35 | @Callable(i) | |
40 | 36 | func withdraw (amount) = { | |
41 | 37 | let wallet = toString(i.caller) | |
42 | 38 | let playerAmount = ExtractPlayerAmt(wallet) | |
43 | 39 | if ((amount > playerAmount)) | |
44 | 40 | then throw("There is not enough balance to withdraw the amount requested.") | |
45 | 41 | else { | |
46 | 42 | let newPlayerAmount = (playerAmount - amount) | |
47 | 43 | let newReservedAmount = (ExtractReservedAmt() - amount) | |
48 | 44 | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY, newReservedAmount), DataEntry(wallet, newPlayerAmount)]), TransferSet([ScriptTransfer(i.caller, amount, WBET)])) | |
49 | 45 | } | |
50 | 46 | } | |
51 | 47 | ||
52 | 48 |
github/deemru/w8io/169f3d6 48.02 ms ◑