tx · 4qmcCnWVMZvQTufm9pyJ9wWEfX87qxT3TYMtsNQWSAMN

3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs:  -0.01400000 Waves

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

{ "type": 13, "id": "4qmcCnWVMZvQTufm9pyJ9wWEfX87qxT3TYMtsNQWSAMN", "fee": 1400000, "feeAssetId": null, "timestamp": 1566938021162, "version": 1, "sender": "3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs", "senderPublicKey": "HSTmdhPrJF81ozDBaqVn8QVtV76oD7gzDfcHPQRdxdwW", "proofs": [ "M5zAdJyHjJiJnmmS23k1csLDAtAhfsWY82wazQpnJZa6b6LK6fhk5yomP4C9Zj1aCJts7oSnGTTgn7D5LFA1qAu" ], "script": "base64:AAIDAAAAAAAAAAAAAAAQAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAAClRva2VuUHJpY2UAAAAAAAAAAAoAAAAAEERPTkFURUNPVU5URVJLRVkCAAAACyRET05BVEVfTlVNAAAAAAdCVVlJVEVNAgAAAAkkQlVZX0lURU0AAAAABEJhZzEJAABoAAAAAgAAAAAAAAAAAQUAAAAHV0FWRUxFVAAAAAAEQmFnNQkAAGgAAAACAAAAAAAAAAAFBQAAAAdXQVZFTEVUAAAAAAVCYWcxMAkAAGgAAAACAAAAAAAAAAAKBQAAAAdXQVZFTEVUAAAAAAVCYWcyMAkAAGgAAAACAAAAAAAAAAAUBQAAAAdXQVZFTEVUAAAAAAVCYWc1MAkAAGgAAAACAAAAAAAAAAAyBQAAAAdXQVZFTEVUAAAAAAZCYWcxMDAJAABoAAAAAgAAAAAAAAAAZA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lCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAADdHR4BQAAAAckbWF0Y2gwBgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAA3N0eAUAAAAHJG1hdGNoMAYHB+dCXQ0=", "chainId": 84, "height": 650084, "spentComplexity": 0 } View: original | compacted Prev: Hk6M1LK5mbsjVd9jwSDM9kKpxDi4JM2VQUKPmSt3ZcSh Next: 32kGkj89KUW4ci8NGuHUXTBrGhMScP865vLDZBkySyhT Diff:
OldNewDifferences
7070 case int: Int =>
7171 toString(int)
7272 case _ =>
73- "found"
73+ "not found"
7474 }
7575 rawDataStr
7676 }
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- "found"
73+ "not 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)
8888 let searchResult = isItemExist(oldItemsList, itemId)
8989 if ((searchResult == ""))
9090 then throw("This item not exist")
9191 else throw(searchResult)
9292 }
9393
9494
9595
9696 @Callable(i)
9797 func reset () = {
9898 let playerAddress = toString(i.caller)
9999 let donateData = [DataEntry(DONATECOUNTERKEY, 0), DataEntry((playerAddress + "_balance"), 0)]
100100 WriteSet(donateData)
101101 }
102102
103103
104104
105105 @Callable(i)
106106 func donate () = {
107107 let newGameNum = IncrementDonateNum()
108108 let donateId = toBase58String(i.transactionId)
109109 let pmt = extract(i.payment)
110110 let playerAddress = toString(i.caller)
111111 let betNotInWaves = isDefined(pmt.assetId)
112112 let feeNotInWaves = isDefined(pmt.assetId)
113113 let donateAmt = pmt.amount
114114 if (betNotInWaves)
115115 then throw("Bet amount must be in Waves")
116116 else if (feeNotInWaves)
117117 then throw("Transaction's fee must be in Waves")
118118 else {
119119 let donateAmtValid = if (if (if (if (if (if ((donateAmt == (Bag1 + COMMISSION)))
120120 then true
121121 else (donateAmt == (Bag5 + COMMISSION)))
122122 then true
123123 else (donateAmt == (Bag10 + COMMISSION)))
124124 then true
125125 else (donateAmt == (Bag20 + COMMISSION)))
126126 then true
127127 else (donateAmt == (Bag50 + COMMISSION)))
128128 then true
129129 else (donateAmt == (Bag100 + COMMISSION)))
130130 then true
131131 else false
132132 if (donateAmtValid)
133133 then {
134134 let donateNum = ((donateAmt - COMMISSION) / WAVELET)
135135 let key2Balance = (playerAddress + "_balance")
136136 let newBalance = (getBalance(key2Balance) + (donateNum * TokenPrice))
137137 let donateData = [DataEntry(DONATECOUNTERKEY, newGameNum), DataEntry(key2Balance, newBalance), DataEntry(donateId, donateNum)]
138138 WriteSet(donateData)
139139 }
140140 else throw("You paid the wrong amount")
141141 }
142142 }
143143
144144
145145 @Verifier(tx)
146146 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
147147 then match tx {
148148 case ttx: TransferTransaction =>
149149 true
150150 case stx: SetScriptTransaction =>
151151 true
152152 case _ =>
153153 false
154154 }
155155 else false
156156

github/deemru/w8io/026f985 
27.48 ms