tx · HzUbBnmAvgNZjossZqzcZ6HopW3BAmLiVdRxAPAY3jjg

3NCUy4yewhhgobHrkdSBNiCYajzXApktxaK:  -0.01000000 Waves

2019.07.22 00:31 [596254] smart account 3NCUy4yewhhgobHrkdSBNiCYajzXApktxaK > SELF 0.00000000 Waves

{ "type": 13, "id": "HzUbBnmAvgNZjossZqzcZ6HopW3BAmLiVdRxAPAY3jjg", "fee": 1000000, "feeAssetId": null, "timestamp": 1563744730160, "version": 1, "sender": "3NCUy4yewhhgobHrkdSBNiCYajzXApktxaK", "senderPublicKey": "AEBLjt3LBirAMqq8TDdsSedvidamCEi6fV1nhL2DEpew", "proofs": [ "2wU7dRJz6L78Uu69CYMEiim3tPpzrcZB3iNskyZqf8Za38omuTt6d6gisT6FkED3b6Xry9bjYATPBiBE9F2riqvf" ], "script": "base64:AAIDAAAAAAAAAAAAAAAFAAAAAA5vd25lclB1YmxpY0tleQEAAAAgfedb8gHq6MpA0xTx8E4brUvyXTxMUxGzgoeMhec7vFkAAAAAH2Rlc3RpbmF0aW9uV2FsbGV0QWRkcmVzc0RhdGFLZXkCAAAAGmRlc3RpbmF0aW9uX3dhbGxldF9hZGRyZXNzAQAAABFnZXRMb290Qm94RGF0YUtleQAAAAEAAAACaWQJAAEsAAAAAgIAAAAJbG9vdF9ib3hfCQABpAAAAAEFAAAAAmlkAQAAABtnZXREZXN0aW5hdGlvbldhbGxldEFkZHJlc3MAAAAABAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAH2Rlc3RpbmF0aW9uV2FsbGV0QWRkcmVzc0RhdGFLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABdgUAAAAHJG1hdGNoMAMJAAAAAAAAAgUAAAABdgIAAAAACQAAAgAAAAECAAAAKkRlc3RpbmF0aW9uIHdhbGxldCBhZGRyZXNzIGNhbm5vdCBiZSBlbXB0eQkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAA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AAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABFnZXRMb290Qm94RGF0YUtleQAAAAEFAAAAAmlkBQAAAAVwcmljZQUAAAADbmlsAAAAAWkBAAAACmJ1eUxvb3RCb3gAAAABAAAAAmlkBAAAAAdwYXltZW50CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQEAAAADGxvb3RCb3hQcmljZQkBAAAAD2dldExvb3RCb3hQcmljZQAAAAEFAAAAAmlkBAAAAAxwbGF5ZXJQYXlTdW0IBQAAAAdwYXltZW50AAAABmFtb3VudAMJAQAAAAIhPQAAAAIFAAAADHBsYXllclBheVN1bQUAAAAMbG9vdEJveFByaWNlCQAAAgAAAAEJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAFFByaWNlIG11c3QgYmUgZXF1YWwgCQABpAAAAAEFAAAADGxvb3RCb3hQcmljZQIAAAASIHdhdmVsZXRzLCBnaXZlbjogCQABpAAAAAEFAAAADHBsYXllclBheVN1bQkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAbZ2V0RGVzdGluYXRpb25XYWxsZXRBZGRyZXNzAAAAAAUAAAAMcGxheWVyUGF5U3VtBQAAAAR1bml0BQAAAANuaWwAAAAARNYDNg==", "chainId": 84, "height": 596254, "spentComplexity": 0 } View: original | compacted Prev: none Next: 3qomQQsHPbsF4SY7KxySSVT4iwvH8S8MFeHFGsEKzxSs Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let ownerPublicKey = base58'9UUaVVahBUyLHLQo4HNuQsRMKY9QBH43Grojkbdf4wG4'
5+
6+let destinationWalletAddressDataKey = "destination_wallet_address"
7+
8+func getLootBoxDataKey (id) = ("loot_box_" + toString(id))
9+
10+
11+func getDestinationWalletAddress () = match getString(this, destinationWalletAddressDataKey) {
12+ case v: String =>
13+ if ((v == ""))
14+ then throw("Destination wallet address cannot be empty")
15+ else addressFromStringValue(v)
16+ case _ =>
17+ throw("Destination wallet address undefined")
18+}
19+
20+
21+func getLootBoxPrice (id) = match getInteger(this, getLootBoxDataKey(id)) {
22+ case v: Int =>
23+ v
24+ case _ =>
25+ throw("Loot box price undefined")
26+}
27+
28+
29+@Callable(i)
30+func setDestinationWallet (address) = if ((i.callerPublicKey != ownerPublicKey))
31+ then throw("Only owner can call this method")
32+ else if ((address == ""))
33+ then throw("Address cannot be empty")
34+ else WriteSet([DataEntry(destinationWalletAddressDataKey, address)])
35+
36+
37+
38+@Callable(i)
39+func setLootBoxPrice (id,price) = if ((i.callerPublicKey != ownerPublicKey))
40+ then throw("Only owner can call this method")
41+ else if ((id == 0))
42+ then throw("Loot id undefined")
43+ else if ((price == 0))
44+ then throw("Price undefined")
45+ else WriteSet([DataEntry(getLootBoxDataKey(id), price)])
46+
47+
48+
49+@Callable(i)
50+func buyLootBox (id) = {
51+ let payment = extract(i.payment)
52+ let lootBoxPrice = getLootBoxPrice(id)
53+ let playerPaySum = payment.amount
54+ if ((playerPaySum != lootBoxPrice))
55+ then throw(((("Price must be equal " + toString(lootBoxPrice)) + " wavelets, given: ") + toString(playerPaySum)))
56+ else TransferSet([ScriptTransfer(getDestinationWalletAddress(), playerPaySum, unit)])
57+ }
58+
59+

github/deemru/w8io/169f3d6 
19.65 ms