tx · BdqtMbDCNtdJcdzZWkxnE5Nb9BAACt7T7o5g3u9JZYqf 3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4: -0.05000000 Waves 2022.06.07 01:09 [2085073] smart account 3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4 > SELF 0.00000000 Waves
{ "type": 13, "id": "BdqtMbDCNtdJcdzZWkxnE5Nb9BAACt7T7o5g3u9JZYqf", "fee": 5000000, "feeAssetId": null, "timestamp": 1654553349394, "version": 2, "chainId": 84, "sender": "3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4", "senderPublicKey": "5nJ4v4Wx6sdXhiDZNrpW7m1aSDsTgTgFJVBgmPMPtbUM", "proofs": [ "MgQoLa11qw6uezG9LmKPnfEN4ZhthHq9nisZS9aDwxeEaQJDQP2M7nphFfYQBxaiGxrAGgvC1aU9nRmCy8CqGFn" ], "script": "base64:AAIFAAAAAAAAAAwIAhIDCgEIEgMKAQgAAAATAAAAAAZzdGFrZXICAAAABnN0YWtlcgAAAAAFYWRtaW4CAAAABmFkbWluXwAAAAALYXNzZXRJZENhbGwCAAAACEFzc2V0IElEAQAAAARnZXRJAAAAAQAAAANrZXkJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AQAAAARnZXRTAAAAAQAAAANrZXkJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AQAAAAVnZXRJVgAAAAEAAAADa2V5CQEAAAAFdmFsdWUAAAABCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQEAAAAFZ2V0U1YAAAABAAAAA2tleQkBAAAABXZhbHVlAAAAAQkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkBAAAAB3Rocm93SWYAAAACAAAACWNvbmRpdGlvbgAAAAVlcnJvcgMFAAAACWNvbmRpdGlvbgkAAAIAAAABBQAAAAVlcnJvcgYAAAAAFHRoaXJ0eURheXNMb2NrUGVyaW9kAAAAAAAAAAAeAAAAABNzaXh0eURheXNMb2NrUGVyaW9kAAAAAAAAAA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5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAFjBXsA=", "height": 2085073, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GppojEQNZwoerhApmhxUekxdHpzmgoq4P3ynuyyVn8jr Next: Di5CWbCqwbXZRkVmouMKnvWxM2aBCpGgnib3564CTmBe Diff:
Old | New | Differences | |
---|---|---|---|
107 | 107 | let checks = adminOnly(i) | |
108 | 108 | if ((checks == checks)) | |
109 | 109 | then { | |
110 | - | let stakerAddress = | |
110 | + | let stakerAddress = fromBase58String(getSV("staker")) | |
111 | 111 | let run = invoke(Address(stakerAddress), "_getAssetIdByTicker", [AssetTicker], nil) | |
112 | 112 | match run { | |
113 | 113 | case a: String => |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let staker = "staker" | |
5 | 5 | ||
6 | 6 | let admin = "admin_" | |
7 | 7 | ||
8 | 8 | let assetIdCall = "Asset ID" | |
9 | 9 | ||
10 | 10 | func getI (key) = getInteger(this, key) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func getS (key) = getString(this, key) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func getIV (key) = value(getInteger(this, key)) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func getSV (key) = value(getString(this, key)) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func throwIf (condition,error) = if (condition) | |
23 | 23 | then throw(error) | |
24 | 24 | else true | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | let thirtyDaysLockPeriod = 30 | |
28 | 28 | ||
29 | 29 | let sixtyDaysLockPeriod = 60 | |
30 | 30 | ||
31 | 31 | let ninetyDaysLockPeriod = 90 | |
32 | 32 | ||
33 | 33 | func throwOrReturnI (val,error) = match val { | |
34 | 34 | case val: Int => | |
35 | 35 | val | |
36 | 36 | case _ => | |
37 | 37 | throw(error) | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func throwOrReturnS (val,error) = match val { | |
42 | 42 | case val: String => | |
43 | 43 | val | |
44 | 44 | case _ => | |
45 | 45 | throw(error) | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func writeInt (key,value) = if ((0 > value)) | |
50 | 50 | then throw(((("writing negative value " + toString(value)) + " for key ") + key)) | |
51 | 51 | else IntegerEntry(key, value) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func writeStr (key,value) = if ((" " == value)) | |
55 | 55 | then throw(("writing an empty string " + value)) | |
56 | 56 | else StringEntry(key, value) | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func writeConstString (key,value) = if (!(isDefined(getS(key)))) | |
60 | 60 | then writeStr(key, value) | |
61 | 61 | else throw(("already initialized: " + key)) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func writeConstInteger (key,value) = if (!(isDefined(getS(key)))) | |
65 | 65 | then writeInt(key, value) | |
66 | 66 | else throw(("already initialized: " + key)) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func adminOnly (i) = { | |
70 | 70 | let inputAddress = toBase58String(i.caller.bytes) | |
71 | 71 | let otherAdmin = (admin + inputAddress) | |
72 | 72 | match getS(admin) { | |
73 | 73 | case a: String => | |
74 | 74 | if ((inputAddress != getS(admin))) | |
75 | 75 | then throw("unauthorized") | |
76 | 76 | else true | |
77 | 77 | case _ => | |
78 | 78 | match getS(otherAdmin) { | |
79 | 79 | case b: String => | |
80 | 80 | if ((inputAddress != getS(otherAdmin))) | |
81 | 81 | then throw("unauthorized") | |
82 | 82 | else true | |
83 | 83 | case _ => | |
84 | 84 | throw("unauthorizd") | |
85 | 85 | } | |
86 | 86 | } | |
87 | 87 | } | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func writeConfigValue (key,data) = match data { | |
91 | 91 | case data: String => | |
92 | 92 | writeConstString(key, data) | |
93 | 93 | case data: Int => | |
94 | 94 | writeConstInteger(key, data) | |
95 | 95 | case _ => | |
96 | 96 | throw("unsupported config type") | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | @Callable(i) | |
101 | 101 | func init (stakerAddress) = [writeConstString(staker, stakerAddress), writeConstString(admin, toBase58String(this.bytes))] | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | 105 | @Callable(i) | |
106 | 106 | func getAssetIdByTicker (AssetTicker) = { | |
107 | 107 | let checks = adminOnly(i) | |
108 | 108 | if ((checks == checks)) | |
109 | 109 | then { | |
110 | - | let stakerAddress = | |
110 | + | let stakerAddress = fromBase58String(getSV("staker")) | |
111 | 111 | let run = invoke(Address(stakerAddress), "_getAssetIdByTicker", [AssetTicker], nil) | |
112 | 112 | match run { | |
113 | 113 | case a: String => | |
114 | 114 | [StringEntry(assetIdCall, a)] | |
115 | 115 | case _ => | |
116 | 116 | nil | |
117 | 117 | } | |
118 | 118 | } | |
119 | 119 | else throw("Strict value is not equal to itself.") | |
120 | 120 | } | |
121 | 121 | ||
122 | 122 |
github/deemru/w8io/026f985 35.27 ms ◑