tx · 9GZX2QiM9Rquy8zeDhB7QBTauQwHsrg75JsTVp2MUjGQ

3NCUy4yewhhgobHrkdSBNiCYajzXApktxaK:  -0.04000000 Waves

2019.09.24 12:37 [690250] smart account 3NCUy4yewhhgobHrkdSBNiCYajzXApktxaK > SELF 0.00000000 Waves

{ "type": 13, "id": "9GZX2QiM9Rquy8zeDhB7QBTauQwHsrg75JsTVp2MUjGQ", "fee": 4000000, "feeAssetId": null, "timestamp": 1569317756742, "version": 1, "sender": "3NCUy4yewhhgobHrkdSBNiCYajzXApktxaK", "senderPublicKey": "AEBLjt3LBirAMqq8TDdsSedvidamCEi6fV1nhL2DEpew", "proofs": [ "TeR6oAsX37ViMihtog46MFkiZjdwejN87FuyJfAKHtZFJn2Ho7VmvxHXL9ZTW3mUgvzpYhEcme5zjtwicPtvcPo" ], "script": "base64:AAIDAAAAAAAAAAAAAAAKAAAAAA5vd25lclB1YmxpY0tleQEAAAAgkD7fCqmCHKVfL8+fGFXRYhqUJqS1aPUU7D38lld+FgAAAAAAH2Rlc3RpbmF0aW9uV2FsbGV0QWRkcmVzc0RhdGFLZXkCAAAAGmRlc3RpbmF0aW9uX3dhbGxldF9hZGRyZXNzAQAAABFnZXRMb290Qm94RGF0YUtleQAAAAEAAAACaWQJAAEsAAAAAgIAAAAJbG9vdF9ib3hfBQAAAAJpZAEAAAAWZ2V0TG9vdEJveFByaWNlRGF0YUtleQAAAAEAAAACaWQJAAEsAAAAAgkBAAAAEWdldExvb3RCb3hEYXRhS2V5AAAAAQUAAAACaWQCAAAABl9wcmljZQEAAAAWZ2V0TG9vdEJveExpbWl0RGF0YUtleQAAAAEAAAACaWQJAAEsAAAAAgkBAAAAEWdldExvb3RCb3hEYXRhS2V5AAAAAQUAAAACaWQCAAAABl9saW1pdAEAAAAZZ2V0TG9vdEJveEJ1eUNvdW50RGF0YUtleQAAAAEAAAACaWQJAAEsAAAAAgkBAAAAEWdldExvb3RCb3hEYXRhS2V5AAAAAQUAAAACaWQCAAAACl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GltaXQCAAAAISBpdGVtcyBkdWUgbGltaXQsIGN1cnJlbnQgY291bnQ6IAkAAaQAAAABBQAAAAhidXlDb3VudAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABlnZXRMb290Qm94QnV5Q291bnREYXRhS2V5AAAAAQUAAAAFaWRTdHIFAAAAC25ld0J1eUNvdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAG2dldERlc3RpbmF0aW9uV2FsbGV0QWRkcmVzcwAAAAAFAAAADHBsYXllclBheVN1bQUAAAAEdW5pdAUAAAADbmlsAAAAADtayXE=", "chainId": 84, "height": 690250, "spentComplexity": 0 } View: original | compacted Prev: 3qomQQsHPbsF4SY7KxySSVT4iwvH8S8MFeHFGsEKzxSs Next: none Diff:
OldNewDifferences
8181 let idStr = toString(id)
8282 let payment = extract(i.payment)
8383 if (isDefined(payment.assetId))
84- then throw("Can hodl waves only at the moment")
84+ then throw("Can hold waves only at the moment")
8585 else {
8686 let buyCount = getLootBoxBuyCount(idStr)
8787 let newBuyCount = (buyCount + 1)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerPublicKey = base58'Ai5K72PXnQpuH5CCLZcpZWSPGyvSmuBY9PHhFEQStzX9'
55
66 let destinationWalletAddressDataKey = "destination_wallet_address"
77
88 func getLootBoxDataKey (id) = ("loot_box_" + id)
99
1010
1111 func getLootBoxPriceDataKey (id) = (getLootBoxDataKey(id) + "_price")
1212
1313
1414 func getLootBoxLimitDataKey (id) = (getLootBoxDataKey(id) + "_limit")
1515
1616
1717 func getLootBoxBuyCountDataKey (id) = (getLootBoxDataKey(id) + "_buy_count")
1818
1919
2020 func getDestinationWalletAddress () = match getString(this, destinationWalletAddressDataKey) {
2121 case v: String =>
2222 if ((v == ""))
2323 then throw("Destination wallet address cannot be empty")
2424 else addressFromStringValue(v)
2525 case _ =>
2626 throw("Destination wallet address undefined")
2727 }
2828
2929
3030 func getLootBoxPrice (id) = match getInteger(this, getLootBoxPriceDataKey(id)) {
3131 case v: Int =>
3232 v
3333 case _ =>
3434 throw("Loot box price undefined")
3535 }
3636
3737
3838 func getLootBoxLimit (id) = match getInteger(this, getLootBoxLimitDataKey(id)) {
3939 case v: Int =>
4040 v
4141 case _ =>
4242 throw("Loot box limit undefined")
4343 }
4444
4545
4646 func getLootBoxBuyCount (id) = match getInteger(this, getLootBoxBuyCountDataKey(id)) {
4747 case v: Int =>
4848 v
4949 case _ =>
5050 0
5151 }
5252
5353
5454 @Callable(i)
5555 func setDestinationWallet (address) = if ((i.callerPublicKey != ownerPublicKey))
5656 then throw("Only owner can call this method")
5757 else if ((address == ""))
5858 then throw("Address cannot be empty")
5959 else WriteSet([DataEntry(destinationWalletAddressDataKey, address)])
6060
6161
6262
6363 @Callable(i)
6464 func setLootBoxInfo (id,price,limit) = if ((i.callerPublicKey != ownerPublicKey))
6565 then throw("Only owner can call this method")
6666 else if ((id == 0))
6767 then throw("Loot id undefined")
6868 else if ((price == 0))
6969 then throw("Price undefined")
7070 else if ((limit == 0))
7171 then throw("Limit undefined")
7272 else {
7373 let idStr = toString(id)
7474 WriteSet([DataEntry(getLootBoxPriceDataKey(idStr), price), DataEntry(getLootBoxLimitDataKey(idStr), limit)])
7575 }
7676
7777
7878
7979 @Callable(i)
8080 func buyLootBox (id) = {
8181 let idStr = toString(id)
8282 let payment = extract(i.payment)
8383 if (isDefined(payment.assetId))
84- then throw("Can hodl waves only at the moment")
84+ then throw("Can hold waves only at the moment")
8585 else {
8686 let buyCount = getLootBoxBuyCount(idStr)
8787 let newBuyCount = (buyCount + 1)
8888 let lootBoxLimit = getLootBoxLimit(idStr)
8989 let lootBoxPrice = getLootBoxPrice(idStr)
9090 let playerPaySum = payment.amount
9191 if ((playerPaySum != lootBoxPrice))
9292 then throw(((("Price must be equal " + toString(lootBoxPrice)) + " wavelets, given: ") + toString(playerPaySum)))
9393 else if ((newBuyCount > lootBoxLimit))
9494 then throw(((("Cannot sale more " + toString(lootBoxLimit)) + " items due limit, current count: ") + toString(buyCount)))
9595 else ScriptResult(WriteSet([DataEntry(getLootBoxBuyCountDataKey(idStr), newBuyCount)]), TransferSet([ScriptTransfer(getDestinationWalletAddress(), playerPaySum, unit)]))
9696 }
9797 }
9898
9999

github/deemru/w8io/169f3d6 
38.79 ms