tx · Hk6M1LK5mbsjVd9jwSDM9kKpxDi4JM2VQUKPmSt3ZcSh

3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs:  -0.01400000 Waves

2019.08.27 23:33 [650083] smart account 3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs > SELF 0.00000000 Waves

{ "type": 13, "id": "Hk6M1LK5mbsjVd9jwSDM9kKpxDi4JM2VQUKPmSt3ZcSh", "fee": 1400000, "feeAssetId": null, "timestamp": 1566937975710, "version": 1, "sender": "3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs", "senderPublicKey": "HSTmdhPrJF81ozDBaqVn8QVtV76oD7gzDfcHPQRdxdwW", "proofs": [ "4q2SY53UsVMFtVcrLuFpM1b6MJ5eKzyuU9FwekWhRGjguXrvcGG876AXQGy4LV1czAJsM4ixFUxjkLnyzR5r41RA" ], "script": "base64:AAIDAAAAAAAAAAAAAAAQAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAAClRva2VuUHJpY2UAAAAAAAAAAAoAAAAAEERPTkFURUNPVU5URVJLRVkCAAAACyRET05BVEVfTlVNAAAAAAdCVVlJVEVNAgAAAAkkQlVZX0lURU0AAAAABEJhZzEJAABoAAAAAgAAAAAAAAAAAQUAAAAHV0FWRUxFVAAAAAAEQmFnNQkAAGgAAAACAAAAAAAAAAAFBQAAAAdXQVZFTEVUAAAAAAVCYWcxMAkAAGgAAAACAAAAAAAAAAAKBQAAAAdXQVZFTEVUAAAAAAVCYWcyMAkAAGgAAAACAAAAAAAAAAAUBQAAAAdXQVZFTEVUAAAAAAVCYWc1MAkAAGgAAAACAAAAAAAAAAAyBQAAAAdXQVZFTEVUAAAAAAZCYWcxMDAJAABoAAAAAgAAAAAAA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AAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAN0dHgFAAAAByRtYXRjaDAGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwBgcHQIGsjQ==", "chainId": 84, "height": 650083, "spentComplexity": 0 } View: original | compacted Prev: 8qagVzc1B8M6tZFeprCTi3RmQRWcWX9qMGCrDBhibCvz Next: 4qmcCnWVMZvQTufm9pyJ9wWEfX87qxT3TYMtsNQWSAMN Diff:
OldNewDifferences
7070 case int: Int =>
7171 toString(int)
7272 case _ =>
73- ""
73+ "found"
7474 }
7575 rawDataStr
7676 }
8585 let NewBalance = (getBalance((playerAddress + "_balance")) - balanceMinus)
8686 let newBalanceData = DataEntry((playerAddress + "_balance"), NewBalance)
8787 let oldItemsList = ExtractItemsList(key2Items)
88- throw(oldItemsList)
88+ let searchResult = isItemExist(oldItemsList, itemId)
89+ if ((searchResult == ""))
90+ then throw("This item not exist")
91+ else throw(searchResult)
8992 }
9093
9194
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let WAVELET = ((100 * 1000) * 1000)
55
66 let COMMISSION = ((5 * WAVELET) / 1000)
77
88 let TokenPrice = 10
99
1010 let DONATECOUNTERKEY = "$DONATE_NUM"
1111
1212 let BUYITEM = "$BUY_ITEM"
1313
1414 let Bag1 = (1 * WAVELET)
1515
1616 let Bag5 = (5 * WAVELET)
1717
1818 let Bag10 = (10 * WAVELET)
1919
2020 let Bag20 = (20 * WAVELET)
2121
2222 let Bag50 = (50 * WAVELET)
2323
2424 let Bag100 = (100 * WAVELET)
2525
2626 func IncrementDonateNum () = {
2727 let gameNum = match getInteger(this, DONATECOUNTERKEY) {
2828 case num: Int =>
2929 num
3030 case _ =>
3131 0
3232 }
3333 (gameNum + 1)
3434 }
3535
3636
3737 func getBalance (key) = {
3838 let playerBalanceNum = match getInteger(this, key) {
3939 case playerBalanceNum: Int =>
4040 playerBalanceNum
4141 case _ =>
4242 0
4343 }
4444 playerBalanceNum
4545 }
4646
4747
4848 func ExtractItemsList (key) = {
4949 let rawDataStr = match getString(this, key) {
5050 case str: String =>
5151 str
5252 case _ =>
5353 ""
5454 }
5555 rawDataStr
5656 }
5757
5858
5959 func getPriceByItemID (itemId) = if ((itemId == "1"))
6060 then 1
6161 else if ((itemId == "2"))
6262 then 4
6363 else if ((itemId == "3"))
6464 then 6
6565 else throw("Неверный ID item")
6666
6767
6868 func isItemExist (oldItemsList,itemId) = {
6969 let rawDataStr = match indexOf(oldItemsList, (itemId + ":")) {
7070 case int: Int =>
7171 toString(int)
7272 case _ =>
73- ""
73+ "found"
7474 }
7575 rawDataStr
7676 }
7777
7878
7979 @Callable(i)
8080 func buy (itemId) = {
8181 let buyTXId = toBase58String(i.transactionId)
8282 let playerAddress = toString(i.caller)
8383 let key2Items = (playerAddress + "_items")
8484 let balanceMinus = getPriceByItemID(itemId)
8585 let NewBalance = (getBalance((playerAddress + "_balance")) - balanceMinus)
8686 let newBalanceData = DataEntry((playerAddress + "_balance"), NewBalance)
8787 let oldItemsList = ExtractItemsList(key2Items)
88- throw(oldItemsList)
88+ let searchResult = isItemExist(oldItemsList, itemId)
89+ if ((searchResult == ""))
90+ then throw("This item not exist")
91+ else throw(searchResult)
8992 }
9093
9194
9295
9396 @Callable(i)
9497 func reset () = {
9598 let playerAddress = toString(i.caller)
9699 let donateData = [DataEntry(DONATECOUNTERKEY, 0), DataEntry((playerAddress + "_balance"), 0)]
97100 WriteSet(donateData)
98101 }
99102
100103
101104
102105 @Callable(i)
103106 func donate () = {
104107 let newGameNum = IncrementDonateNum()
105108 let donateId = toBase58String(i.transactionId)
106109 let pmt = extract(i.payment)
107110 let playerAddress = toString(i.caller)
108111 let betNotInWaves = isDefined(pmt.assetId)
109112 let feeNotInWaves = isDefined(pmt.assetId)
110113 let donateAmt = pmt.amount
111114 if (betNotInWaves)
112115 then throw("Bet amount must be in Waves")
113116 else if (feeNotInWaves)
114117 then throw("Transaction's fee must be in Waves")
115118 else {
116119 let donateAmtValid = if (if (if (if (if (if ((donateAmt == (Bag1 + COMMISSION)))
117120 then true
118121 else (donateAmt == (Bag5 + COMMISSION)))
119122 then true
120123 else (donateAmt == (Bag10 + COMMISSION)))
121124 then true
122125 else (donateAmt == (Bag20 + COMMISSION)))
123126 then true
124127 else (donateAmt == (Bag50 + COMMISSION)))
125128 then true
126129 else (donateAmt == (Bag100 + COMMISSION)))
127130 then true
128131 else false
129132 if (donateAmtValid)
130133 then {
131134 let donateNum = ((donateAmt - COMMISSION) / WAVELET)
132135 let key2Balance = (playerAddress + "_balance")
133136 let newBalance = (getBalance(key2Balance) + (donateNum * TokenPrice))
134137 let donateData = [DataEntry(DONATECOUNTERKEY, newGameNum), DataEntry(key2Balance, newBalance), DataEntry(donateId, donateNum)]
135138 WriteSet(donateData)
136139 }
137140 else throw("You paid the wrong amount")
138141 }
139142 }
140143
141144
142145 @Verifier(tx)
143146 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
144147 then match tx {
145148 case ttx: TransferTransaction =>
146149 true
147150 case stx: SetScriptTransaction =>
148151 true
149152 case _ =>
150153 false
151154 }
152155 else false
153156

github/deemru/w8io/026f985 
145.58 ms