tx · 7D9Q1rgrgbDJFKgQa4vR1bMEN9Nfe7x5iozSENqKTu2s

3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb:  -0.01000000 Waves

2022.05.06 15:24 [2039834] smart account 3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb > SELF 0.00000000 Waves

{ "type": 13, "id": "7D9Q1rgrgbDJFKgQa4vR1bMEN9Nfe7x5iozSENqKTu2s", "fee": 1000000, "feeAssetId": null, "timestamp": 1651839867050, "version": 2, "chainId": 84, "sender": "3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb", "senderPublicKey": "FWSsBbeCwLVkekWhvNKtX6JkrZiruRybKKVuiS3F4bqN", "proofs": [ "38yyPzYPseVPfPBfF6dnTTEMk7Y6J33a8dNMNhRvPtbE2prEeaqPK9434rw2hKt7FcPkNoWLjFSQf5sorudxc7nH" ], "script": "base64:AAIFAAAAAAAAABsIAhIDCgEIEgQKAggIEgUKAwgICBIFCgMICAgAAAASAAAAAApzaGlueXdnZ2lkAQAAACCJac8C/7a6udRxltd5uJl2JrB00Hd59HNuhvD0c58GJgAAAAAPdHJlYXN1cnlBZGRyZXNzAQAAABoBVGX48BYLBMBZQnAankiMl/9+3Bxi8t27/QAAAAAObmF0aW9uc0FkZHJlc3MBAAAAGgFUTYXo3vT4RGtZEDtwX8O3uWUOUfVERm2gAAAAAAxhZG1pbkFkZHJlc3MJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAECAAAAIzNNcE50aVBTUlNxNk5uYVFZazM4QmZXU3paY2dBWVR5clE5AAAAAAxCdWlsZFN0YXJ0ZWQCAAAADUJVSUxEX1NUQVJURUQAAAAADUJ1aWxkRmluaXNoZWQCAAAADkJVSUxEX0ZJTklTSEVEAAAAAAZBc3NldHMJAARMAAAAAgIAAAAEQ2l0eQkABEwAAAACAgAAAAdCYXJyYWNrCQAETAAAAAICAAAABEJhcm4JAARMAAAAAgIAAAAHV2FycmlvcgUAAAADbmlsAAAAAAphc3NldHNDb3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XNzZXRDb2lucwkBAAAADXRyeUdldEludGVnZXIAAAABBQAAAAdhc3NldElkBAAAAAdyZWZDYWxsCQAD/AAAAAQJAQAAAAdBZGRyZXNzAAAAAQUAAAAPdHJlYXN1cnlBZGRyZXNzAgAAAA10cmFuc2ZlckNvaW5zCQAETAAAAAIFAAAACG9sZE93bmVyCQAETAAAAAIFAAAACXRvQWRkcmVzcwkABEwAAAACBQAAAAphc3NldENvaW5zBQAAAANuaWwFAAAAA25pbAQAAAAMY3VycmVudFBvd2VyCQEAAAAUbmF0aW9uc1RyeUdldEludGVnZXIAAAABBQAAAAhvbGRPd25lcgQAAAAKYXNzZXRQb3dlcgkAAZEAAAACBQAAAAthc3NldHNQb3dlcgkBAAAABXZhbHVlAAAAAQkABE8AAAACBQAAAAZBc3NldHMFAAAADHN0ckFzc2V0VHlwZQQAAAACcHcJAAP8AAAABAkBAAAAB0FkZHJlc3MAAAABBQAAAA5uYXRpb25zQWRkcmVzcwIAAAAMc2V0VXNlclBvd2VyCQAETAAAAAIJAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyCQAETAAAAAIJAABlAAAAAgUAAAAMY3VycmVudFBvd2VyBQAAAAphc3NldFBvd2VyBQAAAANuaWwFAAAAA25pbAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAAdhc3NldElkBQAAAANuaWwAAAAAQ4G5xA==", "height": 2039834, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 2iPAeMrpEokwKj41kPuJB1sW11mMwp1M24EgdcXcUe5u Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf'
5+
6+let treasuryAddress = base58'3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ'
7+
8+let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy'
9+
10+let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9")
11+
12+let BuildStarted = "BUILD_STARTED"
13+
14+let BuildFinished = "BUILD_FINISHED"
15+
16+let Assets = ["City", "Barrack", "Barn", "Warrior"]
17+
18+let assetsCost = [1000000000, 1000000000, 1000000000, 500000000]
19+
20+let assetsDelay = [4, 4, 4, 2]
21+
22+let assetsPower = [1000, 500, 500, 0]
23+
24+func treasuryTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) {
25+ case b: Int =>
26+ b
27+ case _ =>
28+ 0
29+}
30+
31+
32+func nationsTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) {
33+ case b: Int =>
34+ b
35+ case _ =>
36+ 0
37+}
38+
39+
40+func tryGetString (key) = match getString(this, key) {
41+ case b: String =>
42+ b
43+ case _ =>
44+ ""
45+}
46+
47+
48+func tryGetInteger (key) = match getInteger(this, key) {
49+ case b: Int =>
50+ b
51+ case _ =>
52+ 0
53+}
54+
55+
56+func getAssetIdKey (txId,assetType) = ((assetType + "_") + toBase58String(txId))
57+
58+
59+func getAssetOwnerKey (txId,assetType) = (getAssetIdKey(txId, assetType) + "_Owner")
60+
61+
62+func getBuildingFinishHeightKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_fh")
63+
64+
65+func getBuildingStatusKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_status")
66+
67+
68+@Callable(i)
69+func StartBuild (strAssetType) = if (!(containsElement(Assets, strAssetType)))
70+ then throw("This asset is not amanged by the system")
71+ else {
72+ let ind = value(indexOf(Assets, strAssetType))
73+ let delayForBuilding = assetsDelay[ind]
74+ let assetBuildCost = assetsCost[ind]
75+ let amountIn = value(i.payments[0].amount)
76+ if ((assetBuildCost > amountIn))
77+ then throw(("You provided less $heg than the needed cost for building this " + strAssetType))
78+ else if ((i.payments[0].assetId != shinywggid))
79+ then throw("Only $HEG payments allowed")
80+ else {
81+ let refCall = invoke(Address(treasuryAddress), "Deposit", nil, [AttachedPayment(shinywggid, value(i.payments[0].amount))])
82+ let results = [StringEntry(getBuildingStatusKey(toString(i.originCaller), i.transactionId, strAssetType), BuildStarted), StringEntry(getAssetOwnerKey(i.transactionId, strAssetType), toString(i.originCaller)), IntegerEntry(getBuildingFinishHeightKey(toString(i.originCaller), i.transactionId, strAssetType), (height + delayForBuilding))]
83+ results
84+ }
85+ }
86+
87+
88+
89+@Callable(i)
90+func FinishBuild (txIdStr,assetStr) = {
91+ let txId = fromBase58String(txIdStr)
92+ let BuildingStatusKey = getBuildingStatusKey(toString(i.caller), txId, assetStr)
93+ let finishHeightKey = getBuildingFinishHeightKey(toString(i.caller), txId, assetStr)
94+ let assetKey = getAssetIdKey(txId, assetStr)
95+ let assetOwner = tryGetString(getAssetOwnerKey(txId, assetStr))
96+ if ((assetOwner != toString(i.caller)))
97+ then throw(("You cannot claim other's players " + assetStr))
98+ else {
99+ let buildingTxStatus = tryGetString(BuildingStatusKey)
100+ if ((buildingTxStatus == ""))
101+ then throw("No pending operations for this asset")
102+ else {
103+ let buildingFinishHeight = getIntegerValue(this, finishHeightKey)
104+ if ((buildingFinishHeight > height))
105+ then throw((((("Building is not finished yet " + toString((buildingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((buildingFinishHeight - height))) + " minutes"))
106+ else {
107+ let idx = value(indexOf(Assets, assetStr))
108+ let assetPower = assetsPower[idx]
109+ let assetCoins = assetsCost[idx]
110+ let refCall = invoke(Address(treasuryAddress), "Pay", [toString(i.caller), assetCoins], nil)
111+ let currentPower = nationsTryGetInteger(toString(i.caller))
112+ let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower + assetPower)], nil)
113+ let results = [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
114+ results
115+ }
116+ }
117+ }
118+ }
119+
120+
121+
122+@Callable(i)
123+func transferOwnership (assetId,newOwner,strAssetType) = if (if ((i.caller != adminAddress))
124+ then (i.caller != this)
125+ else false)
126+ then throw("Only the admin can perform this operation")
127+ else {
128+ let oldOwner = tryGetString((assetId + "_Owner"))
129+ let currentPower = nationsTryGetInteger(oldOwner)
130+ let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
131+ let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil)
132+ let newcurrentPower = nationsTryGetInteger(newOwner)
133+ let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (currentPower + assetPower)], nil)
134+[StringEntry((assetId + "_Owner"), newOwner)]
135+ }
136+
137+
138+
139+@Callable(i)
140+func destroyAssetAndTransfer (assetId,toAddress,strAssetType) = if (if ((i.caller != adminAddress))
141+ then (i.caller != this)
142+ else false)
143+ then throw("Only the admin can perform this operation")
144+ else {
145+ let oldOwner = tryGetString((assetId + "_Owner"))
146+ let assetCoins = tryGetInteger(assetId)
147+ let refCall = invoke(Address(treasuryAddress), "transferCoins", [oldOwner, toAddress, assetCoins], nil)
148+ let currentPower = nationsTryGetInteger(oldOwner)
149+ let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
150+ let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil)
151+[DeleteEntry(assetId)]
152+ }
153+
154+

github/deemru/w8io/169f3d6 
21.49 ms