tx · 3q3CN5HgRTEEbrNsm52Bxj61gB8Ci8EQoAKVVHZ8vZTf 3Mt6UXYiypnA6WwKMJsiXMckF7iNe9kWQci: -0.01000000 Waves 2019.07.20 01:33 [593368] smart account 3Mt6UXYiypnA6WwKMJsiXMckF7iNe9kWQci > SELF 0.00000000 Waves
{ "type": 13, "id": "3q3CN5HgRTEEbrNsm52Bxj61gB8Ci8EQoAKVVHZ8vZTf", "fee": 1000000, "feeAssetId": null, "timestamp": 1563575624061, "version": 1, "sender": "3Mt6UXYiypnA6WwKMJsiXMckF7iNe9kWQci", "senderPublicKey": "dTjHwyXGZRGo3Bk6xykECRRp6TeNkui1UV8qPq66UXA", "proofs": [ "2BgfhG18NYc4uEhWhK6BtrHDebrxxZmEbPmKVcCrKVh6r72oV3SNFXUj3JcDkivZDpWJ9wbC3cXNk5Mo7seBtxjB" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAAA5vd25lclB1YmxpY0tleQEAAAAgfedb8gHq6MpA0xTx8E4brUvyXTxMUxGzgoeMhec7vFkBAAAAG2dldERlc3RpbmF0aW9uV2FsbGV0QWRkcmVzcwAAAAAEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwIAAAAaZGVzdGluYXRpb25fd2FsbGV0X2FkZHJlc3MDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABdgUAAAAHJG1hdGNoMAMJAAAAAAAAAgUAAAABdgIAAAAACQAAAgAAAAECAAAAKkRlc3RpbmF0aW9uIHdhbGxldCBhZGRyZXNzIGNhbm5vdCBiZSBlbXB0eQkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAAF2CQAAAgAAAAECAAAAHERlc3RpbmF0aW9uIHdhbGxldCB1bmRlZmluZWQBAAAAD2dldExvb3RCb3hQcmljZQAAAAEAAAACaWQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACAgAAAAlsb290X2JveF8JA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bGV0QWRkcmVzcwkBAAAAG2dldERlc3RpbmF0aW9uV2FsbGV0QWRkcmVzcwAAAAAEAAAAB3BheW1lbnQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAMbG9vdEJveFByaWNlCQEAAAAPZ2V0TG9vdEJveFByaWNlAAAAAQUAAAACaWQEAAAADHBsYXllclBheVN1bQgFAAAAB3BheW1lbnQAAAAGYW1vdW50AwkBAAAAAiE9AAAAAgUAAAAMcGxheWVyUGF5U3VtBQAAAAxsb290Qm94UHJpY2UJAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAUUHJpY2UgbXVzdCBiZSBlcXVhbCAJAAGkAAAAAQUAAAAMbG9vdEJveFByaWNlAgAAABIgd2F2ZWxldHMsIGdpdmVuOiAJAAGkAAAAAQUAAAAMcGxheWVyUGF5U3VtCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAGGRpc3RpbmF0aW9uV2FsbGV0QWRkcmVzcwUAAAAMcGxheWVyUGF5U3VtBQAAAAR1bml0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24EAAAAAWkFAAAAByRtYXRjaDAGCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleTdckS0=", "chainId": 84, "height": 593368, "spentComplexity": 0 } View: original | compacted Prev: FjfemqxoWEp9sKkpQm7oQfpEe1JVPyrRjFhVYJ3c9Nie Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let ownerPublicKey = base58'9UUaVVahBUyLHLQo4HNuQsRMKY9QBH43Grojkbdf4wG4' | |
5 | + | ||
6 | + | func getDestinationWalletAddress () = match getString(this, "destination_wallet_address") { | |
7 | + | case v: String => | |
8 | + | if ((v == "")) | |
9 | + | then throw("Destination wallet address cannot be empty") | |
10 | + | else addressFromStringValue(v) | |
11 | + | case _ => | |
12 | + | throw("Destination wallet undefined") | |
13 | + | } | |
14 | + | ||
15 | + | ||
16 | + | func getLootBoxPrice (id) = match getInteger(this, ("loot_box_" + toString(id))) { | |
17 | + | case v: Int => | |
18 | + | v | |
19 | + | case _ => | |
20 | + | throw("Loot box price undefined") | |
21 | + | } | |
22 | + | ||
23 | + | ||
24 | + | @Callable(i) | |
25 | + | func setDestinationWallet (address) = if ((i.callerPublicKey != ownerPublicKey)) | |
26 | + | then throw("Only owner can call this method") | |
27 | + | else if ((address == "")) | |
28 | + | then throw("Address cannot be empty") | |
29 | + | else WriteSet([DataEntry("destination_wallet_address", address)]) | |
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | @Callable(i) | |
34 | + | func setLootBoxPrice (id,price) = if ((i.callerPublicKey != ownerPublicKey)) | |
35 | + | then throw("Only owner can call this method") | |
36 | + | else if ((id == 0)) | |
37 | + | then throw("Loot id undefined") | |
38 | + | else if ((price == 0)) | |
39 | + | then throw("Price undefined") | |
40 | + | else WriteSet([DataEntry(("loot_box_" + toString(id)), price)]) | |
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | @Callable(i) | |
45 | + | func buyLootBox (id) = { | |
46 | + | let distinationWalletAddress = getDestinationWalletAddress() | |
47 | + | let payment = extract(i.payment) | |
48 | + | let lootBoxPrice = getLootBoxPrice(id) | |
49 | + | let playerPaySum = payment.amount | |
50 | + | if ((playerPaySum != lootBoxPrice)) | |
51 | + | then throw(((("Price must be equal " + toString(lootBoxPrice)) + " wavelets, given: ") + toString(playerPaySum))) | |
52 | + | else TransferSet([ScriptTransfer(distinationWalletAddress, playerPaySum, unit)]) | |
53 | + | } | |
54 | + | ||
55 | + | ||
56 | + | @Verifier(tx) | |
57 | + | func verify () = match tx { | |
58 | + | case i: InvokeScriptTransaction => | |
59 | + | true | |
60 | + | case _ => | |
61 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
62 | + | } | |
63 | + |
github/deemru/w8io/026f985 97.64 ms ◑