tx · F8RX5Zpt8cunT3oTunQW2BRu4FP5HzAYaNHdYHfa1MU4

3N2iycpXC7Fomf1vYLmz9uUWwLR2ZvxRCyw:  -0.00700000 Waves

2023.03.22 19:45 [2501477] smart account 3N2iycpXC7Fomf1vYLmz9uUWwLR2ZvxRCyw > SELF 0.00000000 Waves

{ "type": 13, "id": "F8RX5Zpt8cunT3oTunQW2BRu4FP5HzAYaNHdYHfa1MU4", "fee": 700000, "feeAssetId": null, "timestamp": 1679503567822, "version": 2, "chainId": 84, "sender": "3N2iycpXC7Fomf1vYLmz9uUWwLR2ZvxRCyw", "senderPublicKey": "3TJ91ZMX9cHrPAcqCiYodSdxYs8AiLNHyvRJNK1PDc6i", "proofs": [ "3sfontfmrzLddg8HD2VovkTD6gLUrtLiGT6Hh9RSCzXWG6GfycazBo2hTtZZnNp7YFEfNQ5Frsx9eg8GxPCkPSsk" ], "script": "base64:BgIcCAISABIDCgEIEgUKAwEBCBIDCgEBEgASAwoBCAUABkF1cnVlcwEgOYDtDd1mVUaSfSlX4MdFqsCgGC27Z5CEtJGKkGOZYFwBCW9ubHlPd25lcgEBaQMJAAACCAUEdGhpcwVieXRlcwgIBQFpBmNhbGxlcgVieXRlcwUEdW5pdAkAAgECKU9ubHkgZGFwcCBhY2NvdW50IGNhbiBjYWxsIHRoaXMgZnVuY3Rpb24hARBnZXRBdXJ1ZXNQYXltZW50AQFpAwkAAAIJAJADAQgFAWkIcGF5bWVudHMAAAkAAgECFFBheW1lbnQgbm90IGF0dGFjaGVkBAFwCQCRAwIIBQFpCHBheW1lbnRzAAAEByRtYXRjaDAIBQFwB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQHYXNzZXRJZAUHJG1hdGNoMAMJAAACBQdhc3NldElkBQZBdXJ1ZXMIBQFwBmFtb3VudAkAAgECIE9ubHkgYXVydWVzIGFjY2VwdGVkIGFzIHBheW1lbnQhCQACAQIgT25seSBhdXJ1ZXMgYWNjZXB0ZWQgYX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RDbnQAAQUDbmlsBQR1bml0CQACAQIcQXNzZXQgYWxyZWFkeSBhZGRlZCB0byBnYW1lIQkAAgECD1dyb25nIE5GVCBzZW50IQkAAgECEENhbid0IGZpbmQgYXNzZXQJAAIBAhtOb3QgYWJsZSB0byBmaW5kIGFzc2V0IGlkISEBaQELcmVtb3ZlQXNzZXQBB2Fzc2V0SWQEBW93bmVyCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzBQdhc3NldElkAwkAAAIJANkEAQUFb3duZXIICAUBaQZjYWxsZXIFYnl0ZXMEByRtYXRjaDAJAOwHAQkA2QQBBQdhc3NldElkAwkAAQIFByRtYXRjaDACBUFzc2V0BAVhc3NldAUHJG1hdGNoMAQDa2V5CQELZ2V0QXNzZXRLZXkBCAUFYXNzZXQEbmFtZQQHYWRkcmVzcwkA2AQBCAgFAWkGY2FsbGVyBWJ5dGVzBAhhc3NldENudAkBEUBleHRyTmF0aXZlKDEwNTApAgUEdGhpcwkArAICBQdhZGRyZXNzBQNrZXkDCQBmAgUIYXNzZXRDbnQAAAkAlAoCCQDMCAIJAQtEZWxldGVFbnRyeQEFB2Fzc2V0SWQJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgUHYWRkcmVzcwUDa2V5CQBlAgUIYXNzZXRDbnQAAQUDbmlsBQR1bml0CQACAQkArAICCQCsAgICBEFsbCAIBQVhc3NldARuYW1lAhUgYXJlIGxvY2sgaW5zaWRlIGdhbWUJAAIBAhBDYW4ndCBmaW5kIGFzc2V0CQACAQIgWW91IGFyZSBub3Qgb3duZXIgb2YgdGhpcyBhc3NldCEAAdaxNA==", "height": 2501477, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 85chFtf9RwJkFyWCunzsnnEP61TNpVh2WHyMGstNDoto Next: CJxBMuAL2KQRwrwrGw3W9AA6PpppM6jmtUv6GeUp1iwa Diff:
OldNewDifferences
129129 let currentCnt = getIntegerValue(this, (address + key))
130130 let issue = Issue(name, description, 1, 0, false)
131131 let issuedAssetId = toBase58String(calculateAssetId(issue))
132- $Tuple2([issue, ScriptTransfer(i.caller, 1, toBytes(issuedAssetId)), Burn(Aurues, auruesAmount), IntegerEntry((address + key), (currentCnt + 1)), StringEntry(issuedAssetId, address)], unit)
132+ $Tuple2([issue, ScriptTransfer(i.caller, 1, calculateAssetId(issue)), Burn(Aurues, auruesAmount), IntegerEntry((address + key), (currentCnt + 1)), StringEntry(issuedAssetId, address)], unit)
133133 }
134134 else throw(("Not enough payment to buy " + name))
135135 }
168168 @Callable(i)
169169 func removeAsset (assetId) = {
170170 let owner = getStringValue(this, assetId)
171- if ((toBytes(owner) == i.caller.bytes))
171+ if ((fromBase58String(owner) == i.caller.bytes))
172172 then match assetInfo(fromBase58String(assetId)) {
173173 case asset: Asset =>
174174 let key = getAssetKey(asset.name)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let Aurues = base58'4sUGAwEDLVm6Z3sNbLapWXtEtMkhRU8fypam9dLT4UjM'
55
66 func onlyOwner (i) = if ((this.bytes == i.caller.bytes))
77 then unit
88 else throw("Only dapp account can call this function!")
99
1010
1111 func getAuruesPayment (i) = if ((size(i.payments) == 0))
1212 then throw("Payment not attached")
1313 else {
1414 let p = i.payments[0]
1515 match p.assetId {
1616 case assetId: ByteVector =>
1717 if ((assetId == Aurues))
1818 then p.amount
1919 else throw("Only aurues accepted as payment!")
2020 case _ =>
2121 throw("Only aurues accepted as payment!")
2222 }
2323 }
2424
2525
2626 func getAssetData (assetId) = if ((assetId == 0))
2727 then $Tuple4("Miner", "Utility building that helps you to mine aurues at certain blovk height.", 30000, "__miner")
2828 else if ((assetId == 1))
2929 then $Tuple4("Canon", "Utility building that helps you to mine aurues at certain blovk height.", 25000, "_canon")
3030 else if ((assetId == 2))
3131 then $Tuple4("Xbow", "Utility building that helps you to mine aurues at certain blovk height.", 15000, "_xbow")
3232 else if ((assetId == 3))
3333 then $Tuple4("Tesla", "Utility building that helps you to mine aurues at certain blovk height.", 20000, "_tesla")
3434 else if ((assetId == 4))
3535 then throw("You can't buy townhall!")
3636 else if ((assetId == 5))
3737 then $Tuple4("Archer", "Utility building that helps you to mine aurues at certain blovk height.", 4500, "_archer")
3838 else if ((assetId == 6))
3939 then $Tuple4("Robot", "Utility building that helps you to mine aurues at certain blovk height.", 5500, "_robo")
4040 else if ((assetId == 7))
4141 then $Tuple4("Valkyriee", "Utility building that helps you to mine aurues at certain blovk height.", 6000, "_valkyriee")
4242 else throw("Unkown assetId!")
4343
4444
4545 func getAssetKey (name) = if ((name == "Miner"))
4646 then "__miner"
4747 else if ((name == "Canon"))
4848 then "_canon"
4949 else if ((name == "Xbow"))
5050 then "_xbow"
5151 else if ((name == "Tesla"))
5252 then "_tesla"
5353 else if ((name == "Townhall"))
5454 then throw("You can't add or remove townhall!")
5555 else if ((name == "Archer"))
5656 then "_archer"
5757 else if ((name == "Robot"))
5858 then "_robo"
5959 else if ((name == "Valkyriee"))
6060 then "_valkyriee"
6161 else throw("Unkown Asset!")
6262
6363
6464 @Callable(i)
6565 func startGame () = {
6666 let address = toBase58String(i.caller.bytes)
6767 let gameStateKey = (address + "_isStrted")
6868 if ((getBoolean(this, gameStateKey) == unit))
6969 then {
7070 let userId = match getInteger(this, "userId") {
7171 case x: Int =>
7272 (x + 1)
7373 case _ =>
7474 0
7575 }
7676 let thIssue = Issue("Townhall", "HQ of your empire", 1, 0, false)
7777 let thAssetId = toBase58String(calculateAssetId(thIssue))
7878 $Tuple2([BooleanEntry(gameStateKey, true), Reissue(Aurues, 100000, true), ScriptTransfer(i.caller, 100000, Aurues), thIssue, StringEntry(thAssetId, address), IntegerEntry("userId", userId), StringEntry(toString(userId), address), IntegerEntry((address + "_townhall"), 1), IntegerEntry((address + "_townhall_placed"), 0), IntegerEntry((address + "_miner"), 0), IntegerEntry((address + "_miner_placed"), 0), IntegerEntry((address + "_canon"), 0), IntegerEntry((address + "_canon_placed"), 0), IntegerEntry((address + "_xbow"), 0), IntegerEntry((address + "_xbow_placed"), 0), IntegerEntry((address + "_tesla"), 0), IntegerEntry((address + "_tesla_placed"), 0), IntegerEntry((address + "_archer"), 0), IntegerEntry((address + "_robo"), 0), IntegerEntry((address + "_valkyriee"), 0)], unit)
7979 }
8080 else throw("Game already started!")
8181 }
8282
8383
8484
8585 @Callable(i)
8686 func saveGame (data) = {
8787 let thCnt = (size(split_51C(data, "buildingIndex':4")) - 1)
8888 let minerCnt = (size(split_51C(data, "buildingIndex':0")) - 1)
8989 let canonCnt = (size(split_51C(data, "buildingIndex':1")) - 1)
9090 let xbowCnt = (size(split_51C(data, "buildingIndex':2")) - 1)
9191 let teslaCnt = (size(split_51C(data, "buildingIndex':3")) - 1)
9292 let address = toBase58String(i.caller.bytes)
9393 let thAva = (getIntegerValue(this, (address + "_townhall")) + getIntegerValue(this, (address + "_townhall_placed")))
9494 let minerAva = (getIntegerValue(this, (address + "_miner")) + getIntegerValue(this, (address + "_miner_placed")))
9595 let canonAva = (getIntegerValue(this, (address + "_canon")) + getIntegerValue(this, (address + "_canon_placed")))
9696 let xbowAva = (getIntegerValue(this, (address + "_xbow")) + getIntegerValue(this, (address + "_xbow_placed")))
9797 let teslaAva = (getIntegerValue(this, (address + "_tesla")) + getIntegerValue(this, (address + "_tesla_placed")))
9898 if (if (if (if (if ((thAva >= thCnt))
9999 then (minerAva >= minerCnt)
100100 else false)
101101 then (canonAva >= canonCnt)
102102 else false)
103103 then (xbowAva >= xbowCnt)
104104 else false)
105105 then (teslaAva >= teslaCnt)
106106 else false)
107107 then $Tuple2([StringEntry((address + "_data"), data), IntegerEntry((address + "_townhall"), (thAva - thCnt)), IntegerEntry((address + "_townhall_placed"), thCnt), IntegerEntry((address + "_miner"), (minerAva - minerCnt)), IntegerEntry((address + "_miner_placed"), minerCnt), IntegerEntry((address + "_canon"), (canonAva - canonCnt)), IntegerEntry((address + "_canon_placed"), canonCnt), IntegerEntry((address + "_xbow"), (xbowAva - xbowCnt)), IntegerEntry((address + "_xbow_placed"), xbowCnt), IntegerEntry((address + "_tesla"), (teslaAva - teslaCnt)), IntegerEntry((address + "_tesla_placed"), teslaCnt)], unit)
108108 else throw("Placed more building then you owned!")
109109 }
110110
111111
112112
113113 @Callable(i)
114114 func rewardWar (building,troops,opponent) = $Tuple2([Reissue(Aurues, ((building * 5000) + (troops * 2000)), true), ScriptTransfer(i.caller, (building * 5000), Aurues), ScriptTransfer(Address(fromBase58String(opponent)), (troops * 2000), Aurues)], unit)
115115
116116
117117
118118 @Callable(i)
119119 func buy (assetId) = {
120120 let address = toBase58String(i.caller.bytes)
121121 let auruesAmount = getAuruesPayment(i)
122122 let $t071407199 = getAssetData(assetId)
123123 let name = $t071407199._1
124124 let description = $t071407199._2
125125 let price = $t071407199._3
126126 let key = $t071407199._4
127127 if ((auruesAmount >= price))
128128 then {
129129 let currentCnt = getIntegerValue(this, (address + key))
130130 let issue = Issue(name, description, 1, 0, false)
131131 let issuedAssetId = toBase58String(calculateAssetId(issue))
132- $Tuple2([issue, ScriptTransfer(i.caller, 1, toBytes(issuedAssetId)), Burn(Aurues, auruesAmount), IntegerEntry((address + key), (currentCnt + 1)), StringEntry(issuedAssetId, address)], unit)
132+ $Tuple2([issue, ScriptTransfer(i.caller, 1, calculateAssetId(issue)), Burn(Aurues, auruesAmount), IntegerEntry((address + key), (currentCnt + 1)), StringEntry(issuedAssetId, address)], unit)
133133 }
134134 else throw(("Not enough payment to buy " + name))
135135 }
136136
137137
138138
139139 @Callable(i)
140140 func addAsset () = if ((size(i.payments) == 0))
141141 then throw("No NFT attached to this call!")
142142 else {
143143 let nft = i.payments[0]
144144 match nft.assetId {
145145 case assetId: ByteVector =>
146146 match assetInfo(assetId) {
147147 case asset: Asset =>
148148 if ((asset.issuer == this))
149149 then if ((getString(this, toBase58String(assetId)) == unit))
150150 then {
151151 let address = toBase58String(i.caller.bytes)
152152 let key = getAssetKey(asset.name)
153153 let assetCnt = getIntegerValue(this, (address + key))
154154 $Tuple2([ScriptTransfer(Address(i.caller.bytes), 1, assetId), StringEntry(toBase58String(assetId), address), IntegerEntry((address + key), (assetCnt + 1))], unit)
155155 }
156156 else throw("Asset already added to game!")
157157 else throw("Wrong NFT sent!")
158158 case _ =>
159159 throw("Can't find asset")
160160 }
161161 case _ =>
162162 throw("Not able to find asset id!!")
163163 }
164164 }
165165
166166
167167
168168 @Callable(i)
169169 func removeAsset (assetId) = {
170170 let owner = getStringValue(this, assetId)
171- if ((toBytes(owner) == i.caller.bytes))
171+ if ((fromBase58String(owner) == i.caller.bytes))
172172 then match assetInfo(fromBase58String(assetId)) {
173173 case asset: Asset =>
174174 let key = getAssetKey(asset.name)
175175 let address = toBase58String(i.caller.bytes)
176176 let assetCnt = getIntegerValue(this, (address + key))
177177 if ((assetCnt > 0))
178178 then $Tuple2([DeleteEntry(assetId), IntegerEntry((address + key), (assetCnt - 1))], unit)
179179 else throw((("All " + asset.name) + " are lock inside game"))
180180 case _ =>
181181 throw("Can't find asset")
182182 }
183183 else throw("You are not owner of this asset!")
184184 }
185185
186186

github/deemru/w8io/026f985 
51.44 ms