tx · CA1uSVLZxkZMJAKeWjY6XY2cL5rsqMnfnkr9tDUUKV3c 3Mt7wmkWeioUsmfaBu6PsNq9j9SUs7f9qrs: -0.04000000 Waves 2022.10.14 12:28 [2271841] smart account 3Mt7wmkWeioUsmfaBu6PsNq9j9SUs7f9qrs > SELF 0.00000000 Waves
{ "type": 13, "id": "CA1uSVLZxkZMJAKeWjY6XY2cL5rsqMnfnkr9tDUUKV3c", "fee": 4000000, "feeAssetId": null, "timestamp": 1665739728944, "version": 1, "sender": "3Mt7wmkWeioUsmfaBu6PsNq9j9SUs7f9qrs", "senderPublicKey": "BLEvt3fBtK9gbCuj3VA7nHviqe3TPkRrF9KL6ZaHGgr4", "proofs": [ "Q68jPn8H41LooyBE9Q1JActM5fLqLU6fCGJ6mWFkpjepKtUzLSkCkZKgkCQCQ59brtbaxPJ7xHXdCh1XXdaZ1R4" ], "script": "base64:BgIQCAISBQoDCAEBEgASAwoBCC8AC3JldmlzaW9uTnVtAig2N2E3OTAzOGFlODA4YzM4YjJmMzBjMzhkN2NlZTFmODNmMTkxMmMwAAZFVUxFUjgA1onPgQEABU1VTFQ2AMCEPQAGTVVMVFg2CQC2AgEAwIQ9AAVNVUxUOACAwtcvAAZNVUxUWDgJALYCAQCAwtcvAAZNVUxUMTIAgKCUpY0dAAZNVUxUMTgJALYCAQCAgJC7utat8A0AA1NFUAICX18AB1dBVkVTSUQJANkEAQIFV0FWRVMBD2dldFN0cmluZ09yRmFpbAIHYWRkcmVzcwNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQdhZGRyZXNzBQNrZXkJALkJAgkAzAgCAgptYW5kYXRvcnkgCQDMCAIJAKUIAQUHYWRkcmVzcwkAzAgCAgEuCQDMCAIFA2tleQkAzAgCAg8gaXMgbm90IGRlZmluZWQFA25pbAIAAQxnZXRJbnRPckZhaWwCB2FkZHJlc3MDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJoIAgUHYWRkcmVzcwUDa2V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9OTFkBFXVzZXJBZGRyZXNzU3RyT3JFbXB0eQQNbnNidFJld2FyZFN0cgkBCGFzU3RyaW5nAQkA/AcEBRNuc2J0U3Rha2luZ0NvbnRyYWN0Ahh1bmNsYWltZWRSZXdhcmRzUkVBRE9OTFkJAMwIAgUVdXNlckFkZHJlc3NTdHJPckVtcHR5BQNuaWwFA25pbAQNc3VyZlJld2FyZFN0cgkBCGFzU3RyaW5nAQkA/AcEBRNzdXJmU3Rha2luZ0NvbnRyYWN0Ahh1bmNsYWltZWRSZXdhcmRzUkVBRE9OTFkJAMwIAgUVdXNlckFkZHJlc3NTdHJPckVtcHR5BQNuaWwFA25pbAkAlAoCBQNuaWwJAMwIAgUNbnNidFJld2FyZFN0cgkAzAgCBQ1zdXJmUmV3YXJkU3RyBQNuaWwA++bgVQ==", "chainId": 84, "height": 2271841, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CQkRyYDeEdPYP8qRyeikygj2NnNfcgF2Qgz7BsWnfysW Next: 2BKzVwtEUzd874fV7Pc8uVLysxhwJShZuTwzMvN1axeo Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let revisionNum = " | |
4 | + | let revisionNum = "67a79038ae808c38b2f30c38d7cee1f83f1912c0" | |
5 | 5 | ||
6 | 6 | let EULER8 = 271828182 | |
7 | 7 | ||
169 | 169 | func claimRewards () = { | |
170 | 170 | let nsbtInv = asInt(invoke(nsbtStakingContract, "claimRewardsByOriginCaller", nil, nil)) | |
171 | 171 | let surfInv = asInt(invoke(surfStakingContract, "claimRewardsByOriginCaller", nil, nil)) | |
172 | - | if (if ((nsbtInv == 0)) | |
173 | - | then (surfInv == 0) | |
174 | - | else false) | |
172 | + | if (((nsbtInv + surfInv) == 0)) | |
175 | 173 | then throw("Nothing to claim") | |
176 | 174 | else nil | |
177 | 175 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let revisionNum = " | |
4 | + | let revisionNum = "67a79038ae808c38b2f30c38d7cee1f83f1912c0" | |
5 | 5 | ||
6 | 6 | let EULER8 = 271828182 | |
7 | 7 | ||
8 | 8 | let MULT6 = 1000000 | |
9 | 9 | ||
10 | 10 | let MULTX6 = toBigInt(1000000) | |
11 | 11 | ||
12 | 12 | let MULT8 = 100000000 | |
13 | 13 | ||
14 | 14 | let MULTX8 = toBigInt(100000000) | |
15 | 15 | ||
16 | 16 | let MULT12 = 1000000000000 | |
17 | 17 | ||
18 | 18 | let MULT18 = toBigInt(1000000000000000000) | |
19 | 19 | ||
20 | 20 | let SEP = "__" | |
21 | 21 | ||
22 | 22 | let WAVESID = fromBase58String("WAVES") | |
23 | 23 | ||
24 | 24 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func convertNeutrinoToWaves (amount,price) = fraction(amount, MULT8, price) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func convertWavesToNeutrino (amount,price) = fraction(amount, price, MULT8) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func asAnyList (val) = match val { | |
40 | 40 | case valAnyList: List[Any] => | |
41 | 41 | valAnyList | |
42 | 42 | case _ => | |
43 | 43 | throw("fail to cast into List[Any]") | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func asInt (val) = match val { | |
48 | 48 | case valInt: Int => | |
49 | 49 | valInt | |
50 | 50 | case _ => | |
51 | 51 | throw("fail to cast into Int") | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func asString (val) = match val { | |
56 | 56 | case valStr: String => | |
57 | 57 | valStr | |
58 | 58 | case _ => | |
59 | 59 | throw("fail to cast into String") | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func asTuple2Ints (val) = match val { | |
64 | 64 | case v: (Int, Int) => | |
65 | 65 | v | |
66 | 66 | case _ => | |
67 | 67 | throw("fail to cast into Tuple2 ints") | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func asSwapParamsSTRUCT (val) = match val { | |
72 | 72 | case struct: (Int, Int, Int, Int, Int, Int, Int) => | |
73 | 73 | struct | |
74 | 74 | case _ => | |
75 | 75 | throw("fail to cast into SwapParamsSTRUCT") | |
76 | 76 | } | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func toTimestamp (start) = if ((0 > start)) | |
80 | 80 | then -1 | |
81 | 81 | else match blockInfoByHeight(start) { | |
82 | 82 | case block: BlockInfo => | |
83 | 83 | block.timestamp | |
84 | 84 | case _ => | |
85 | 85 | -1 | |
86 | 86 | } | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULT18, toBigInt(origScaleMult)) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULT18)) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | let IdxControlCfgNeutrinoDapp = 1 | |
96 | 96 | ||
97 | 97 | let IdxControlCfgAuctionDapp = 2 | |
98 | 98 | ||
99 | 99 | let IdxControlCfgRpdDapp = 3 | |
100 | 100 | ||
101 | 101 | let IdxControlCfgMathDapp = 4 | |
102 | 102 | ||
103 | 103 | let IdxControlCfgLiquidationDapp = 5 | |
104 | 104 | ||
105 | 105 | let IdxControlCfgRestDapp = 6 | |
106 | 106 | ||
107 | 107 | let IdxControlCfgNodeRegistryDapp = 7 | |
108 | 108 | ||
109 | 109 | let IdxControlCfgNsbtStakingDapp = 8 | |
110 | 110 | ||
111 | 111 | let IdxControlCfgMediatorDapp = 9 | |
112 | 112 | ||
113 | 113 | let IdxControlCfgSurfStakingDapp = 10 | |
114 | 114 | ||
115 | 115 | let IdxControlCfgGnsbtControllerDapp = 11 | |
116 | 116 | ||
117 | 117 | func keyControlAddress () = "%s%s__config__controlAddress" | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func keyControlCfg () = "%s__controlConfig" | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func readControlCfgOrFail (control) = split(getStringOrFail(control, keyControlCfg()), SEP) | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx))) | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")) | |
130 | 130 | ||
131 | 131 | let controlCfg = readControlCfgOrFail(controlContract) | |
132 | 132 | ||
133 | 133 | let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp) | |
134 | 134 | ||
135 | 135 | let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp) | |
136 | 136 | ||
137 | 137 | let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp) | |
138 | 138 | ||
139 | 139 | let liquidationContract = getContractAddressOrFail(controlCfg, IdxControlCfgLiquidationDapp) | |
140 | 140 | ||
141 | 141 | let rpdContract = getContractAddressOrFail(controlCfg, IdxControlCfgRpdDapp) | |
142 | 142 | ||
143 | 143 | let nsbtStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgNsbtStakingDapp) | |
144 | 144 | ||
145 | 145 | let surfStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgSurfStakingDapp) | |
146 | 146 | ||
147 | 147 | @Callable(i) | |
148 | 148 | func gnsbtInfoSYSREADONLY (userAddressStrOrEmpty,nsbtDiff,surfDiff) = { | |
149 | 149 | let nsbtData = asAnyList(invoke(nsbtStakingContract, "nsbtStakingSYSREADONLY", [userAddressStrOrEmpty, nsbtDiff], nil)) | |
150 | 150 | let nsbtUser = asInt(nsbtData[0]) | |
151 | 151 | let nsbtTotal = asInt(nsbtData[1]) | |
152 | 152 | let gNsbtFromNsbtUser = nsbtUser | |
153 | 153 | let gNsbtFromNsbtTotal = nsbtTotal | |
154 | 154 | let surfData = asAnyList(invoke(surfStakingContract, "surfStakingSYSREADONLY", [userAddressStrOrEmpty, surfDiff], nil)) | |
155 | 155 | let surfUser = asInt(surfData[0]) | |
156 | 156 | let surfTotal = asInt(surfData[1]) | |
157 | 157 | let gNsbtFromSurfUser = asInt(surfData[2]) | |
158 | 158 | let gNsbtFromSurfTotal = asInt(surfData[3]) | |
159 | 159 | let vpEffectiveHeight = asInt(surfData[4]) | |
160 | 160 | let vpEffectiveHeightNEW = asInt(surfData[5]) | |
161 | 161 | let gNsbtUser = (gNsbtFromNsbtUser + gNsbtFromSurfUser) | |
162 | 162 | let gNsbtTotal = (gNsbtFromNsbtTotal + gNsbtFromSurfTotal) | |
163 | 163 | $Tuple2(nil, [gNsbtUser, gNsbtTotal, [nsbtUser, nsbtTotal, gNsbtFromNsbtUser, gNsbtFromNsbtTotal], [surfUser, surfTotal, gNsbtFromSurfUser, gNsbtFromSurfTotal], vpEffectiveHeight, vpEffectiveHeightNEW]) | |
164 | 164 | } | |
165 | 165 | ||
166 | 166 | ||
167 | 167 | ||
168 | 168 | @Callable(i) | |
169 | 169 | func claimRewards () = { | |
170 | 170 | let nsbtInv = asInt(invoke(nsbtStakingContract, "claimRewardsByOriginCaller", nil, nil)) | |
171 | 171 | let surfInv = asInt(invoke(surfStakingContract, "claimRewardsByOriginCaller", nil, nil)) | |
172 | - | if (if ((nsbtInv == 0)) | |
173 | - | then (surfInv == 0) | |
174 | - | else false) | |
172 | + | if (((nsbtInv + surfInv) == 0)) | |
175 | 173 | then throw("Nothing to claim") | |
176 | 174 | else nil | |
177 | 175 | } | |
178 | 176 | ||
179 | 177 | ||
180 | 178 | ||
181 | 179 | @Callable(i) | |
182 | 180 | func gnsbtRewardsSYSREADONLY (userAddressStrOrEmpty) = { | |
183 | 181 | let nsbtRewardStr = asString(invoke(nsbtStakingContract, "unclaimedRewardsREADONLY", [userAddressStrOrEmpty], nil)) | |
184 | 182 | let surfRewardStr = asString(invoke(surfStakingContract, "unclaimedRewardsREADONLY", [userAddressStrOrEmpty], nil)) | |
185 | 183 | $Tuple2(nil, [nsbtRewardStr, surfRewardStr]) | |
186 | 184 | } | |
187 | 185 | ||
188 | 186 |
github/deemru/w8io/169f3d6 31.35 ms ◑