tx · B9cdsqbSqdt6HRruTRKEy9r7g2LxjmTnSeQKpZ1UXw7i 3N2iycpXC7Fomf1vYLmz9uUWwLR2ZvxRCyw: -0.00400000 Waves 2023.03.19 23:33 [2497377] smart account 3N2iycpXC7Fomf1vYLmz9uUWwLR2ZvxRCyw > SELF 0.00000000 Waves
{ "type": 13, "id": "B9cdsqbSqdt6HRruTRKEy9r7g2LxjmTnSeQKpZ1UXw7i", "fee": 400000, "feeAssetId": null, "timestamp": 1679257998503, "version": 2, "chainId": 84, "sender": "3N2iycpXC7Fomf1vYLmz9uUWwLR2ZvxRCyw", "senderPublicKey": "3TJ91ZMX9cHrPAcqCiYodSdxYs8AiLNHyvRJNK1PDc6i", "proofs": [ "xnTMxQxmWraNCDUoPup6FUY9MXSCToMoUhb9UezEG1eK4cFEPPSk78NFW914U5oKkA8rCBiAh4QKozcg581PzfY" ], "script": "base64:BgISCAISAwoBCBIAEgMKAQESABIAAwEJb25seU93bmVyAQFpAwkAAAIIBQR0aGlzBWJ5dGVzCAgFAWkGY2FsbGVyBWJ5dGVzBQR1bml0CQACAQIpT25seSBkYXBwIGFjY291bnQgY2FuIGNhbGwgdGhpcyBmdW5jdGlvbiEBEGdldEF1cnVlc1BheW1lbnQBAWkDCQAAAgkAkAMBCAUBaQhwYXltZW50cwAACQACAQIUUGF5bWVudCBub3QgYXR0YWNoZWQEBkF1cnVlcwkAmwMBCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzAgZBdXJ1ZXMEAXAJAJEDAggFAWkIcGF5bWVudHMAAAQHJG1hdGNoMAgFAXAHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAdhc3NldElkBQckbWF0Y2gwAwkAAAIFB2Fzc2V0SWQFBkF1cnVlcwgFAXAGYW1vdW50CQACAQIgT25seSBhdXJ1ZXMgYWNjZXB0ZWQgYXMgcGF5bWVudCEJAAIBAiBPbmx5IGF1cnVlcyBhY2NlcHRlZCBhcyBwYXltZW50IQEMZ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cCBQxhdXJ1ZXNBbW91bnQFBXByaWNlBApjdXJyZW50Q250CQERQGV4dHJOYXRpdmUoMTA1MCkCBQR0aGlzCQCsAgIFB2FkZHJlc3MFA2tleQQFaXNzdWUJAMIIBQUEbmFtZQULZGVzY3JpcHRpb24AAQAABwQNaXNzdWVkQXNzZXRJZAkA2AQBCQC4CAEFBWlzc3VlCQCUCgIJAMwIAgUFaXNzdWUJAMwIAgkBBEJ1cm4CBQZBdXJ1ZXMFDGF1cnVlc0Ftb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQdhZGRyZXNzBQNrZXkJAGQCBQpjdXJyZW50Q250AAEJAMwIAgkBC1N0cmluZ0VudHJ5AgUNaXNzdWVkQXNzZXRJZAUHYWRkcmVzcwUDbmlsBQR1bml0CQACAQkArAICAhpOb3QgZW5vdWdoIHBheW1lbnQgdG8gYnV5IAUEbmFtZQFpAQhhZGRBc3NldAAJAJQKAgUDbmlsBQR1bml0AWkBC3JlbW92ZUFzc2V0AAkAlAoCBQNuaWwFBHVuaXQAvaPb/A==", "height": 2497377, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 3peFp4UMKNWAxmBkfe7ST71CAYthHZAPeUBV5NXmrhmc Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func onlyOwner (i) = if ((this.bytes == i.caller.bytes)) | |
5 | + | then unit | |
6 | + | else throw("Only dapp account can call this function!") | |
7 | + | ||
8 | + | ||
9 | + | func getAuruesPayment (i) = if ((size(i.payments) == 0)) | |
10 | + | then throw("Payment not attached") | |
11 | + | else { | |
12 | + | let Aurues = toBytes(getStringValue(this, "Aurues")) | |
13 | + | let p = i.payments[0] | |
14 | + | match p.assetId { | |
15 | + | case assetId: ByteVector => | |
16 | + | if ((assetId == Aurues)) | |
17 | + | then p.amount | |
18 | + | else throw("Only aurues accepted as payment!") | |
19 | + | case _ => | |
20 | + | throw("Only aurues accepted as payment!") | |
21 | + | } | |
22 | + | } | |
23 | + | ||
24 | + | ||
25 | + | func getAssetData (assetId) = if ((assetId == 0)) | |
26 | + | then $Tuple4("Miner", "Utility building that helps you to mine aurues at certain blovk height.", 30000, "__miner") | |
27 | + | else if ((assetId == 1)) | |
28 | + | then $Tuple4("Canon", "Utility building that helps you to mine aurues at certain blovk height.", 25000, "_canon") | |
29 | + | else if ((assetId == 2)) | |
30 | + | then $Tuple4("Xbow", "Utility building that helps you to mine aurues at certain blovk height.", 15000, "_xbow") | |
31 | + | else if ((assetId == 3)) | |
32 | + | then $Tuple4("Tesla", "Utility building that helps you to mine aurues at certain blovk height.", 20000, "_tesla") | |
33 | + | else if ((assetId == 4)) | |
34 | + | then throw("You can't buy townhall!") | |
35 | + | else if ((assetId == 5)) | |
36 | + | then $Tuple4("Archer", "Utility building that helps you to mine aurues at certain blovk height.", 4500, "_archer") | |
37 | + | else if ((assetId == 6)) | |
38 | + | then $Tuple4("Robot", "Utility building that helps you to mine aurues at certain blovk height.", 5500, "_robo") | |
39 | + | else $Tuple4("Valkyriee", "Utility building that helps you to mine aurues at certain blovk height.", 6000, "_valkyriee") | |
40 | + | ||
41 | + | ||
42 | + | @Callable(i) | |
43 | + | func init (Aurues) = { | |
44 | + | let ownerCheck = onlyOwner(i) | |
45 | + | if ((ownerCheck == ownerCheck)) | |
46 | + | then if ((getString(this, "Aurues") == unit)) | |
47 | + | then $Tuple2([StringEntry("Aurues", Aurues)], unit) | |
48 | + | else throw("Game already init!") | |
49 | + | else throw("Strict value is not equal to itself.") | |
50 | + | } | |
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | @Callable(i) | |
55 | + | func startGame () = { | |
56 | + | let address = toBase58String(i.caller.bytes) | |
57 | + | let Aurues = toBytes(getStringValue(this, "Aurues")) | |
58 | + | let gameStateKey = (address + "_isStrted") | |
59 | + | if ((getBoolean(this, gameStateKey) == unit)) | |
60 | + | then { | |
61 | + | let thIssue = Issue("Townhall", "HQ of your empire", 1, 0, false) | |
62 | + | let thAssetId = toBase58String(calculateAssetId(thIssue)) | |
63 | + | $Tuple2([BooleanEntry(gameStateKey, true), Reissue(Aurues, 100000, true), thIssue, StringEntry(thAssetId, 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) | |
64 | + | } | |
65 | + | else throw("Game already started!") | |
66 | + | } | |
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | @Callable(i) | |
71 | + | func buy (assetId) = { | |
72 | + | let address = toBase58String(i.caller.bytes) | |
73 | + | let Aurues = toBytes(getStringValue(this, "Aurues")) | |
74 | + | let auruesAmount = getAuruesPayment(i) | |
75 | + | let $t038743933 = getAssetData(assetId) | |
76 | + | let name = $t038743933._1 | |
77 | + | let description = $t038743933._2 | |
78 | + | let price = $t038743933._3 | |
79 | + | let key = $t038743933._4 | |
80 | + | if ((auruesAmount >= price)) | |
81 | + | then { | |
82 | + | let currentCnt = getIntegerValue(this, (address + key)) | |
83 | + | let issue = Issue(name, description, 1, 0, false) | |
84 | + | let issuedAssetId = toBase58String(calculateAssetId(issue)) | |
85 | + | $Tuple2([issue, Burn(Aurues, auruesAmount), IntegerEntry((address + key), (currentCnt + 1)), StringEntry(issuedAssetId, address)], unit) | |
86 | + | } | |
87 | + | else throw(("Not enough payment to buy " + name)) | |
88 | + | } | |
89 | + | ||
90 | + | ||
91 | + | ||
92 | + | @Callable(i) | |
93 | + | func addAsset () = $Tuple2(nil, unit) | |
94 | + | ||
95 | + | ||
96 | + | ||
97 | + | @Callable(i) | |
98 | + | func removeAsset () = $Tuple2(nil, unit) | |
99 | + | ||
100 | + |
github/deemru/w8io/026f985 16.37 ms ◑