tx · GN8tJPmxbWbXtCRvcWaE56yjth8Czs26jZPd9K6X5FHb

3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs:  -0.01400000 Waves

2019.08.28 00:17 [650131] smart account 3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs > SELF 0.00000000 Waves

{ "type": 13, "id": "GN8tJPmxbWbXtCRvcWaE56yjth8Czs26jZPd9K6X5FHb", "fee": 1400000, "feeAssetId": null, "timestamp": 1566940664700, "version": 1, "sender": "3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs", "senderPublicKey": "HSTmdhPrJF81ozDBaqVn8QVtV76oD7gzDfcHPQRdxdwW", "proofs": [ "iCeCzwcNfAmKQmF4QW5a7TXyRECwuQpNT9u6kM7dJHnbuv5q5Y6Gx2HFsjmyPnn4Fb83yjrF7dptsS6ff9RDToM" ], "script": "base64:AAIDAAAAAAAAAAAAAAAQAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAAClRva2VuUHJpY2UAAAAAAAAAAAoAAAAAEERPTkFURUNPVU5URVJLRVkCAAAACyRET05BVEVfTlVNAAAAAAdCVVlJVEVNAgAAAAkkQlVZX0lURU0AAAAABEJhZzEJAABoAAAAAgAAAAAAAAAAAQUAAAAHV0FWRUxFVAAAAAAEQmFnNQkAAGgAAAACAAAAAAAAAAAFBQAAAAdXQVZFTEVUAAAAAAVCYWcxMAkAAGgAAAACAAAAAAAAAAAKBQAAAAdXQVZFTEVUAAAAAAVCYWcyMAkAAGgAAAACAAAAAAAAAAAUBQAAAAdXQVZFTEVUAAAAAAVCYWc1MAkAAGgAAAACAAAAAAAAAAAyBQAAAAdXQVZFTEVUAAAAAAZCYWcxMDAJAABoAAAAAgAAAAAAAAAAZAU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vdSBwYWlkIHRoZSB3cm9uZyBhbW91bnQAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAN0dHgFAAAAByRtYXRjaDAGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwBgcH1jFnZQ==", "chainId": 84, "height": 650131, "spentComplexity": 0 } View: original | compacted Prev: GY1d3fNpDDQpDPH6wfFoGwHj9uvXXbbXKQUxkzZi5sGX Next: DJU3Nw2ZUdBCc5Dp4iYvpXoKdw3rPazAMt8rSYu7PVY5 Diff:
OldNewDifferences
6464 func buyItem (itemId) = {
6565 let buyTXId = toBase58String(i.transactionId)
6666 let playerAddress = toString(i.caller)
67- if (if ((itemId > 0))
68- then (itemMax >= itemId)
69- else false)
67+ if ((itemMax >= itemId))
7068 then {
7169 let balanceMinus = prices[itemId]
7270 let NewBalance = (getBalance((playerAddress + "_balance")) - balanceMinus)
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 let itemMax = 20
2727
2828 let prices = [1, 3, 5, 6, 2, 2, 4, 9, 10, 12, 5, 1, 9, 12, 5, 4, 1, 11, 12, 9]
2929
3030 func IncrementDonateNum () = {
3131 let gameNum = match getInteger(this, DONATECOUNTERKEY) {
3232 case num: Int =>
3333 num
3434 case _ =>
3535 0
3636 }
3737 (gameNum + 1)
3838 }
3939
4040
4141 func getBalance (key) = {
4242 let playerBalanceNum = match getInteger(this, key) {
4343 case playerBalanceNum: Int =>
4444 playerBalanceNum
4545 case _ =>
4646 0
4747 }
4848 playerBalanceNum
4949 }
5050
5151
5252 func isItemExist (oldItemsList,itemId) = {
5353 let rawDataStr = match indexOf(oldItemsList, (itemId + ":")) {
5454 case int: Int =>
5555 toString(int)
5656 case _ =>
5757 "undefined"
5858 }
5959 rawDataStr
6060 }
6161
6262
6363 @Callable(i)
6464 func buyItem (itemId) = {
6565 let buyTXId = toBase58String(i.transactionId)
6666 let playerAddress = toString(i.caller)
67- if (if ((itemId > 0))
68- then (itemMax >= itemId)
69- else false)
67+ if ((itemMax >= itemId))
7068 then {
7169 let balanceMinus = prices[itemId]
7270 let NewBalance = (getBalance((playerAddress + "_balance")) - balanceMinus)
7371 let newBalanceData = DataEntry((playerAddress + "_balance"), NewBalance)
7472 let keyToItem = ((playerAddress + "_itemID_") + toString(itemId))
7573 WriteSet([DataEntry(keyToItem, 1), DataEntry(((BUYITEM + "_") + buyTXId), itemId), newBalanceData])
7674 }
7775 else throw("Item has not found")
7876 }
7977
8078
8179
8280 @Callable(i)
8381 func reset () = {
8482 let playerAddress = toString(i.caller)
8583 let donateData = [DataEntry(DONATECOUNTERKEY, 0), DataEntry((playerAddress + "_balance"), 0)]
8684 WriteSet(donateData)
8785 }
8886
8987
9088
9189 @Callable(i)
9290 func donate () = {
9391 let newGameNum = IncrementDonateNum()
9492 let donateId = toBase58String(i.transactionId)
9593 let pmt = extract(i.payment)
9694 let playerAddress = toString(i.caller)
9795 let betNotInWaves = isDefined(pmt.assetId)
9896 let feeNotInWaves = isDefined(pmt.assetId)
9997 let donateAmt = pmt.amount
10098 if (betNotInWaves)
10199 then throw("Bet amount must be in Waves")
102100 else if (feeNotInWaves)
103101 then throw("Transaction's fee must be in Waves")
104102 else {
105103 let donateAmtValid = if (if (if (if (if (if ((donateAmt == (Bag1 + COMMISSION)))
106104 then true
107105 else (donateAmt == (Bag5 + COMMISSION)))
108106 then true
109107 else (donateAmt == (Bag10 + COMMISSION)))
110108 then true
111109 else (donateAmt == (Bag20 + COMMISSION)))
112110 then true
113111 else (donateAmt == (Bag50 + COMMISSION)))
114112 then true
115113 else (donateAmt == (Bag100 + COMMISSION)))
116114 then true
117115 else false
118116 if (donateAmtValid)
119117 then {
120118 let donateNum = ((donateAmt - COMMISSION) / WAVELET)
121119 let key2Balance = (playerAddress + "_balance")
122120 let newBalance = (getBalance(key2Balance) + (donateNum * TokenPrice))
123121 let donateData = [DataEntry(DONATECOUNTERKEY, newGameNum), DataEntry(key2Balance, newBalance), DataEntry(donateId, donateNum)]
124122 WriteSet(donateData)
125123 }
126124 else throw("You paid the wrong amount")
127125 }
128126 }
129127
130128
131129 @Verifier(tx)
132130 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
133131 then match tx {
134132 case ttx: TransferTransaction =>
135133 true
136134 case stx: SetScriptTransaction =>
137135 true
138136 case _ =>
139137 false
140138 }
141139 else false
142140

github/deemru/w8io/026f985 
38.09 ms