tx · 5dPt5PkF8BwD815Q9mCuvpTw9dBy3UWm8omE7izpjrvL 3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy: -0.01000000 Waves 2022.06.13 11:57 [2094390] smart account 3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy > SELF 0.00000000 Waves
{ "type": 13, "id": "5dPt5PkF8BwD815Q9mCuvpTw9dBy3UWm8omE7izpjrvL", "fee": 1000000, "feeAssetId": null, "timestamp": 1655110641929, "version": 2, "chainId": 84, "sender": "3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy", "senderPublicKey": "3o2zJzkX9SQ65BrfAiyV4tuKneQz8eDLocKmiai1L6Tg", "proofs": [ "2SNUjrznuPY4VzXvHa7YpBuTrGYDTMbMz9zFmUQj45NoZjHotxkK5tLMTmqJSidi6b95FYsLuRWpt7MkL3pZkW72" ], "script": "base64:AAIFAAAAAAAAABkIAhIDCgEBEgQKAggBEgQKAggBEgQKAggIAAAAGAAAAAAKc2hpbnl3Z2dpZAEAAAAgiWnPAv+2urnUcZbXebiZdiawdNB3efRzbobw9HOfBiYAAAAAD3RyZWFzdXJ5QWRkcmVzcwEAAAAaAVRl+PAWCwTAWUJwGp5IjJf/ftwcYvLdu/0AAAAADWFzc2V0c0FkZHJlc3MBAAAAGgFUy+a0wXfXHSctaxYQS8qRSOspiwoalaeaAAAAABJtYXJrZXRwbGFjZUFkZHJlc3MBAAAAGgFUHSG5k/H8GMOnG0lxFkOWUXTrrFQuJbzvAAAAABRjb25maWd1cmF0aW9uQWRkcmVzcwEAAAAaAVTbIMuXkVY/Qg5sp2U1gothv7V0cji00C4AAAAADm5hdGlvbnNBZGRyZXNzAQAAABoBVE2F6N70+ERrWRA7cF/Dt7llDlH1REZtoAAAAAALYWRtaW5XYWxsZXQJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAECAAAAIzNNcE50aVBTUlNxNk5uYVFZazM4QmZXU3paY2dBWVR5clE5AAAAABZkYWlseU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QAAAAtTdHJpbmdFbnRyeQAAAAIJAAGkAAAAAQUAAAAIbmF0aW9uSWQFAAAACU5hdGlvbmtleQUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABaQEAAAAYc2V0VGVjbmhub2xvZ3lEaXNjb3ZlcmVkAAAAAgAAAAluYXRpb25LZXkAAAANdGVjaG5vbG9neUtleQMJAQAAAAEhAAAAAQkBAAAACmNoZWNrQWRtaW4AAAABCAUAAAABaQAAAAZjYWxsZXIJAAACAAAAAQIAAAApT25seSB0aGUgYWRtaW4gY2FuIHBlcmZvcm0gdGhpcyBvcGVyYXRpb24EAAAACU5hdGlvbmtleQkAASwAAAACCQABLAAAAAIFAAAACW5hdGlvbktleQIAAAABXwUAAAANdGVjaG5vbG9neUtleQkABRQAAAACCQAETAAAAAIJAQAAAAxCb29sZWFuRW50cnkAAAACBQAAAAlOYXRpb25rZXkGBQAAAANuaWwGAAAAAPZVAaU=", "height": 2094390, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BE4fUWknvjSZai3VXef385TKWrqDc2zvmYBz6SdfBPDA Next: GFm8dhSqPDmXZrjhmtZmfgfxPaf8MpQMMRFFjdYtj6RS Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | ||
10 | 10 | let marketplaceAddress = base58'3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A' | |
11 | 11 | ||
12 | - | let | |
12 | + | let configurationAddress = base58'3N9tj3b2djcaZozn97VkYchL9S1i6cdEbC1' | |
13 | 13 | ||
14 | - | let startNationsSHEG = 90000000000 | |
14 | + | let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
15 | + | ||
16 | + | let adminWallet = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
17 | + | ||
18 | + | let dailyGameRewardsWallet = addressFromStringValue("3MuSrXTTiwo9bdoD6FeaBpMUYMiU5saDv2U") | |
19 | + | ||
20 | + | let dailyStakingRewardsWallet = addressFromStringValue("3Mv3mr3uNXdpgkVPApbGEJjMQXqau37DY5i") | |
21 | + | ||
22 | + | func checkAdmin (caller) = if (if (if (if ((caller == adminWallet)) | |
23 | + | then true | |
24 | + | else (caller == this)) | |
25 | + | then true | |
26 | + | else (caller.bytes == assetsAddress)) | |
27 | + | then true | |
28 | + | else (caller.bytes == treasuryAddress)) | |
29 | + | then true | |
30 | + | else (caller.bytes == marketplaceAddress) | |
31 | + | ||
15 | 32 | ||
16 | 33 | func tryGetInteger (key) = match getInteger(this, key) { | |
17 | 34 | case b: Int => | |
29 | 46 | } | |
30 | 47 | ||
31 | 48 | ||
32 | - | func checkAdmin (caller) = if (if (if (if ((caller == adminAddress)) | |
33 | - | then true | |
34 | - | else (caller == this)) | |
35 | - | then true | |
36 | - | else (caller.bytes == assetsAddress)) | |
37 | - | then true | |
38 | - | else (caller.bytes == treasuryAddress)) | |
39 | - | then true | |
40 | - | else (caller.bytes == marketplaceAddress) | |
49 | + | func tryGetString (key) = match getString(this, key) { | |
50 | + | case b: String => | |
51 | + | b | |
52 | + | case _ => | |
53 | + | "" | |
54 | + | } | |
41 | 55 | ||
56 | + | ||
57 | + | func getALKey (Name,Level) = ((Name + "_lvl") + toString(Level)) | |
58 | + | ||
59 | + | ||
60 | + | func confTryGetInteger (key) = match getInteger(Address(configurationAddress), key) { | |
61 | + | case b: Int => | |
62 | + | b | |
63 | + | case _ => | |
64 | + | 0 | |
65 | + | } | |
66 | + | ||
67 | + | ||
68 | + | func confTryGetString (key) = match getString(Address(configurationAddress), key) { | |
69 | + | case b: String => | |
70 | + | b | |
71 | + | case _ => | |
72 | + | "" | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | func confTryGetBoolean (key) = match getBoolean(Address(configurationAddress), key) { | |
77 | + | case b: Boolean => | |
78 | + | b | |
79 | + | case _ => | |
80 | + | false | |
81 | + | } | |
82 | + | ||
83 | + | ||
84 | + | func getTreasuryKey (nationid) = (nationid + "_Treasury") | |
85 | + | ||
86 | + | ||
87 | + | func treasuryTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) { | |
88 | + | case b: Int => | |
89 | + | b | |
90 | + | case _ => | |
91 | + | 0 | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | func nationsTryGetInteger (key) = match getInteger(Address(nationsAddress), key) { | |
96 | + | case b: Int => | |
97 | + | b | |
98 | + | case _ => | |
99 | + | 0 | |
100 | + | } | |
101 | + | ||
102 | + | ||
103 | + | func nationsTryGetBoolean (key) = match getBoolean(Address(nationsAddress), key) { | |
104 | + | case b: Boolean => | |
105 | + | b | |
106 | + | case _ => | |
107 | + | false | |
108 | + | } | |
109 | + | ||
110 | + | ||
111 | + | func nationsTryGetString (key) = match getString(Address(nationsAddress), key) { | |
112 | + | case b: String => | |
113 | + | b | |
114 | + | case _ => | |
115 | + | "" | |
116 | + | } | |
117 | + | ||
118 | + | ||
119 | + | func getAssetOwnerKeyString (assetId) = (assetId + "_Owner") | |
120 | + | ||
121 | + | ||
122 | + | let startNationsSHEG = 90000000000 | |
42 | 123 | ||
43 | 124 | @Callable(i) | |
44 | 125 | func setUserNation (nationId) = [IntegerEntry(toString(i.caller), nationId)] | |
57 | 138 | then throw("Only the admin can perform this operation") | |
58 | 139 | else { | |
59 | 140 | let Nationkey = ("Nation_" + toBase58String(i.transactionId)) | |
60 | - | let deposit = invoke(Address(treasuryAddress), "increaseNationWallet", [Nationkey, startNationsSHEG], | |
141 | + | let deposit = invoke(Address(treasuryAddress), "increaseNationWallet", [Nationkey, startNationsSHEG], i.payments) | |
61 | 142 | if ((deposit == deposit)) | |
62 | 143 | then { | |
63 | 144 | let own = invoke(Address(assetsAddress), "setNationOwner", [Nationkey, strOwner], nil) | |
64 | 145 | if ((own == own)) | |
65 | - | then [IntegerEntry(Nationkey, nationId)] | |
146 | + | then [IntegerEntry(Nationkey, nationId), StringEntry(toString(nationId), Nationkey)] | |
66 | 147 | else throw("Strict value is not equal to itself.") | |
67 | 148 | } | |
68 | 149 | else throw("Strict value is not equal to itself.") | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | ||
154 | + | @Callable(i) | |
155 | + | func setTecnhnologyDiscovered (nationKey,technologyKey) = if (!(checkAdmin(i.caller))) | |
156 | + | then throw("Only the admin can perform this operation") | |
157 | + | else { | |
158 | + | let Nationkey = ((nationKey + "_") + technologyKey) | |
159 | + | $Tuple2([BooleanEntry(Nationkey, true)], true) | |
69 | 160 | } | |
70 | 161 | ||
71 | 162 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf' | |
5 | 5 | ||
6 | 6 | let treasuryAddress = base58'3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ' | |
7 | 7 | ||
8 | 8 | let assetsAddress = base58'3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb' | |
9 | 9 | ||
10 | 10 | let marketplaceAddress = base58'3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A' | |
11 | 11 | ||
12 | - | let | |
12 | + | let configurationAddress = base58'3N9tj3b2djcaZozn97VkYchL9S1i6cdEbC1' | |
13 | 13 | ||
14 | - | let startNationsSHEG = 90000000000 | |
14 | + | let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
15 | + | ||
16 | + | let adminWallet = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
17 | + | ||
18 | + | let dailyGameRewardsWallet = addressFromStringValue("3MuSrXTTiwo9bdoD6FeaBpMUYMiU5saDv2U") | |
19 | + | ||
20 | + | let dailyStakingRewardsWallet = addressFromStringValue("3Mv3mr3uNXdpgkVPApbGEJjMQXqau37DY5i") | |
21 | + | ||
22 | + | func checkAdmin (caller) = if (if (if (if ((caller == adminWallet)) | |
23 | + | then true | |
24 | + | else (caller == this)) | |
25 | + | then true | |
26 | + | else (caller.bytes == assetsAddress)) | |
27 | + | then true | |
28 | + | else (caller.bytes == treasuryAddress)) | |
29 | + | then true | |
30 | + | else (caller.bytes == marketplaceAddress) | |
31 | + | ||
15 | 32 | ||
16 | 33 | func tryGetInteger (key) = match getInteger(this, key) { | |
17 | 34 | case b: Int => | |
18 | 35 | b | |
19 | 36 | case _ => | |
20 | 37 | 0 | |
21 | 38 | } | |
22 | 39 | ||
23 | 40 | ||
24 | 41 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
25 | 42 | case b: Boolean => | |
26 | 43 | b | |
27 | 44 | case _ => | |
28 | 45 | false | |
29 | 46 | } | |
30 | 47 | ||
31 | 48 | ||
32 | - | func checkAdmin (caller) = if (if (if (if ((caller == adminAddress)) | |
33 | - | then true | |
34 | - | else (caller == this)) | |
35 | - | then true | |
36 | - | else (caller.bytes == assetsAddress)) | |
37 | - | then true | |
38 | - | else (caller.bytes == treasuryAddress)) | |
39 | - | then true | |
40 | - | else (caller.bytes == marketplaceAddress) | |
49 | + | func tryGetString (key) = match getString(this, key) { | |
50 | + | case b: String => | |
51 | + | b | |
52 | + | case _ => | |
53 | + | "" | |
54 | + | } | |
41 | 55 | ||
56 | + | ||
57 | + | func getALKey (Name,Level) = ((Name + "_lvl") + toString(Level)) | |
58 | + | ||
59 | + | ||
60 | + | func confTryGetInteger (key) = match getInteger(Address(configurationAddress), key) { | |
61 | + | case b: Int => | |
62 | + | b | |
63 | + | case _ => | |
64 | + | 0 | |
65 | + | } | |
66 | + | ||
67 | + | ||
68 | + | func confTryGetString (key) = match getString(Address(configurationAddress), key) { | |
69 | + | case b: String => | |
70 | + | b | |
71 | + | case _ => | |
72 | + | "" | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | func confTryGetBoolean (key) = match getBoolean(Address(configurationAddress), key) { | |
77 | + | case b: Boolean => | |
78 | + | b | |
79 | + | case _ => | |
80 | + | false | |
81 | + | } | |
82 | + | ||
83 | + | ||
84 | + | func getTreasuryKey (nationid) = (nationid + "_Treasury") | |
85 | + | ||
86 | + | ||
87 | + | func treasuryTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) { | |
88 | + | case b: Int => | |
89 | + | b | |
90 | + | case _ => | |
91 | + | 0 | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | func nationsTryGetInteger (key) = match getInteger(Address(nationsAddress), key) { | |
96 | + | case b: Int => | |
97 | + | b | |
98 | + | case _ => | |
99 | + | 0 | |
100 | + | } | |
101 | + | ||
102 | + | ||
103 | + | func nationsTryGetBoolean (key) = match getBoolean(Address(nationsAddress), key) { | |
104 | + | case b: Boolean => | |
105 | + | b | |
106 | + | case _ => | |
107 | + | false | |
108 | + | } | |
109 | + | ||
110 | + | ||
111 | + | func nationsTryGetString (key) = match getString(Address(nationsAddress), key) { | |
112 | + | case b: String => | |
113 | + | b | |
114 | + | case _ => | |
115 | + | "" | |
116 | + | } | |
117 | + | ||
118 | + | ||
119 | + | func getAssetOwnerKeyString (assetId) = (assetId + "_Owner") | |
120 | + | ||
121 | + | ||
122 | + | let startNationsSHEG = 90000000000 | |
42 | 123 | ||
43 | 124 | @Callable(i) | |
44 | 125 | func setUserNation (nationId) = [IntegerEntry(toString(i.caller), nationId)] | |
45 | 126 | ||
46 | 127 | ||
47 | 128 | ||
48 | 129 | @Callable(i) | |
49 | 130 | func setUserPower (address,newPower) = if (!(checkAdmin(i.caller))) | |
50 | 131 | then throw("Only the admin can perform this operation") | |
51 | 132 | else $Tuple2([IntegerEntry((address + "_Power"), newPower)], newPower) | |
52 | 133 | ||
53 | 134 | ||
54 | 135 | ||
55 | 136 | @Callable(i) | |
56 | 137 | func setNationDiscovered (strOwner,nationId) = if (!(checkAdmin(i.caller))) | |
57 | 138 | then throw("Only the admin can perform this operation") | |
58 | 139 | else { | |
59 | 140 | let Nationkey = ("Nation_" + toBase58String(i.transactionId)) | |
60 | - | let deposit = invoke(Address(treasuryAddress), "increaseNationWallet", [Nationkey, startNationsSHEG], | |
141 | + | let deposit = invoke(Address(treasuryAddress), "increaseNationWallet", [Nationkey, startNationsSHEG], i.payments) | |
61 | 142 | if ((deposit == deposit)) | |
62 | 143 | then { | |
63 | 144 | let own = invoke(Address(assetsAddress), "setNationOwner", [Nationkey, strOwner], nil) | |
64 | 145 | if ((own == own)) | |
65 | - | then [IntegerEntry(Nationkey, nationId)] | |
146 | + | then [IntegerEntry(Nationkey, nationId), StringEntry(toString(nationId), Nationkey)] | |
66 | 147 | else throw("Strict value is not equal to itself.") | |
67 | 148 | } | |
68 | 149 | else throw("Strict value is not equal to itself.") | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | ||
154 | + | @Callable(i) | |
155 | + | func setTecnhnologyDiscovered (nationKey,technologyKey) = if (!(checkAdmin(i.caller))) | |
156 | + | then throw("Only the admin can perform this operation") | |
157 | + | else { | |
158 | + | let Nationkey = ((nationKey + "_") + technologyKey) | |
159 | + | $Tuple2([BooleanEntry(Nationkey, true)], true) | |
69 | 160 | } | |
70 | 161 | ||
71 | 162 |
github/deemru/w8io/026f985 29.64 ms ◑