tx · APnetdAnvy1jYfaCQfBP8HEmtSjMGG2muNaKi29g8Ge 3Mt6UXYiypnA6WwKMJsiXMckF7iNe9kWQci: -0.01000000 Waves 2019.07.20 00:21 [593296] smart account 3Mt6UXYiypnA6WwKMJsiXMckF7iNe9kWQci > SELF 0.00000000 Waves
{ "type": 13, "id": "APnetdAnvy1jYfaCQfBP8HEmtSjMGG2muNaKi29g8Ge", "fee": 1000000, "feeAssetId": null, "timestamp": 1563571271011, "version": 1, "sender": "3Mt6UXYiypnA6WwKMJsiXMckF7iNe9kWQci", "senderPublicKey": "dTjHwyXGZRGo3Bk6xykECRRp6TeNkui1UV8qPq66UXA", "proofs": [ "2J68E6eerTiwW5xPc6Wfg4gYPpTCjgJBgwW7evSAKJGAcsZp2rTeMeXnjyXNmpsoprDMmAdypz4uH25cQaghEjEA" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAAA5vd25lclB1YmxpY0tleQEAAAAgfedb8gHq6MpA0xTx8E4brUvyXTxMUxGzgoeMhec7vFkBAAAAG2dldERlc3RpbmF0aW9uV2FsbGV0QWRkcmVzcwAAAAAEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwIAAAAdZGVzdGluYXRpb25fd2FsbGV0X3B1YmxpY19rZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABdgUAAAAHJG1hdGNoMAMJAAAAAAAAAgUAAAABdgIAAAAACQAAAgAAAAECAAAAKkRlc3RpbmF0aW9uIHdhbGxldCBhZGRyZXNzIGNhbm5vdCBiZSBlbXB0eQkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQkAAZsAAAABBQAAAAF2CQAAAgAAAAECAAAAHERlc3RpbmF0aW9uIHdhbGxldCB1bmRlZmluZWQBAAAAD2dldExvb3RCb3hQcmljZQAAAAEAAAACaWQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACAgAAAAlsb290X2JveF8JAAGkAAAAAQ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QWRkcmVzcwkBAAAAG2dldERlc3RpbmF0aW9uV2FsbGV0QWRkcmVzcwAAAAAEAAAAB3BheW1lbnQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAMbG9vdEJveFByaWNlCQEAAAAPZ2V0TG9vdEJveFByaWNlAAAAAQUAAAACaWQEAAAADHBsYXllclBheVN1bQgFAAAAB3BheW1lbnQAAAAGYW1vdW50AwkBAAAAAiE9AAAAAgUAAAAMcGxheWVyUGF5U3VtBQAAAAxsb290Qm94UHJpY2UJAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAUUHJpY2UgbXVzdCBiZSBlcXVhbCAJAAGkAAAAAQUAAAAMbG9vdEJveFByaWNlAgAAABIgd2F2ZWxldHMsIGdpdmVuOiAJAAGkAAAAAQUAAAAMcGxheWVyUGF5U3VtCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAGGRpc3RpbmF0aW9uV2FsbGV0QWRkcmVzcwUAAAAMcGxheWVyUGF5U3VtBQAAAAR1bml0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24EAAAAAWkFAAAAByRtYXRjaDAGCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlee0ZjGE=", "chainId": 84, "height": 593296, "spentComplexity": 0 } View: original | compacted Prev: Hy7MAWPc1BpC3nW9CUbV1TXhEUQbVq3Hq94NyPJaCpvm Next: FjfemqxoWEp9sKkpQm7oQfpEe1JVPyrRjFhVYJ3c9Nie 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_public_key") { | |
7 | + | case v: String => | |
8 | + | if ((v == "")) | |
9 | + | then throw("Destination wallet address cannot be empty") | |
10 | + | else addressFromPublicKey(toBytes(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 (publicKey) = if ((i.callerPublicKey != ownerPublicKey)) | |
26 | + | then throw("Only owner can call this method") | |
27 | + | else if ((publicKey == "")) | |
28 | + | then throw("Public key cannot be empty") | |
29 | + | else WriteSet([DataEntry("destination_wallet_public_key", publicKey)]) | |
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 22.85 ms ◑