tx · 8VxFpMDDQrrtHDJGgPNvidZ89kGzSEEt8RaHuPvSaTGh 3Mt7wmkWeioUsmfaBu6PsNq9j9SUs7f9qrs: -0.01000000 Waves 2022.11.21 13:53 [2326779] smart account 3Mt7wmkWeioUsmfaBu6PsNq9j9SUs7f9qrs > SELF 0.00000000 Waves
{ "type": 13, "id": "8VxFpMDDQrrtHDJGgPNvidZ89kGzSEEt8RaHuPvSaTGh", "fee": 1000000, "feeAssetId": null, "timestamp": 1669027985132, "version": 2, "chainId": 84, "sender": "3Mt7wmkWeioUsmfaBu6PsNq9j9SUs7f9qrs", "senderPublicKey": "BLEvt3fBtK9gbCuj3VA7nHviqe3TPkRrF9KL6ZaHGgr4", "proofs": [ "3BagkquFWuE7ZLYx6XLKJ2yobCNR1Y4WwFdiiD8qEgR5h2561A3R4z81hhtjn8WRviATeZFFP5dE4kzyYKQbaPST" ], "script": "base64:BgIQCAISBQoDCAEBEgASAwoBCDsAC3JldmlzaW9uTnVtAgAABkVVTEVSOADWic+BAQAFTVVMVDYAwIQ9AAZNVUxUWDYJALYCAQDAhD0ABU1VTFQ4AIDC1y8ABk1VTFRYOAkAtgIBAIDC1y8ABk1VTFQxMgCAoJSljR0ABk1VTFQxOAkAtgIBAICAkLu61q3wDQADU0VQAgJfXwAHV0FWRVNJRAkA2QQBAgVXQVZFUwEPZ2V0U3RyaW5nT3JGYWlsAgdhZGRyZXNzA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFB2FkZHJlc3MFA2tleQkAuQkCCQDMCAICCm1hbmRhdG9yeSAJAMwIAgkApQgBBQdhZGRyZXNzCQDMCAICAS4JAMwIAgUDa2V5CQDMCAICDyBpcyBub3QgZGVmaW5lZAUDbmlsAgABDGdldEludE9yRmFpbAIHYWRkcmVzcwNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAmggCBQdhZGRyZXNzBQNrZXkJALkJAgkAzAgCAgptYW5kYXRvcnkgCQDMCAIJAKUIAQ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ity": 0 } View: original | compacted Prev: 2BKzVwtEUzd874fV7Pc8uVLysxhwJShZuTwzMvN1axeo Next: HanFeBzrKV8M7SJmVRkPNy6BsfeoakJ8vSnLzdKBjYVF Diff:
Old | New | Differences | |
---|---|---|---|
144 | 144 | ||
145 | 145 | let surfStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgSurfStakingDapp) | |
146 | 146 | ||
147 | + | let IdxSurfUser = 0 | |
148 | + | ||
149 | + | let IdxSurfTotal = 1 | |
150 | + | ||
151 | + | let IdxSurfGnsbtUser = 2 | |
152 | + | ||
153 | + | let IdxSurfGnsbtTotal = 3 | |
154 | + | ||
155 | + | let IdxSurfVpCurr = 4 | |
156 | + | ||
157 | + | let IdxSurfVpNew = 5 | |
158 | + | ||
159 | + | let IdxSurfTotalMature = 6 | |
160 | + | ||
161 | + | let IdxSurfTotalTeen = 7 | |
162 | + | ||
163 | + | let IdxSurfTotalKid = 8 | |
164 | + | ||
165 | + | let IdxSurfUserMature = 9 | |
166 | + | ||
167 | + | let IdxSurfUserTeen = 10 | |
168 | + | ||
169 | + | let IdxSurfUserKid = 11 | |
170 | + | ||
147 | 171 | @Callable(i) | |
148 | 172 | func gnsbtInfoSYSREADONLY (userAddressStrOrEmpty,nsbtDiff,surfDiff) = { | |
149 | 173 | let nsbtData = asAnyList(invoke(nsbtStakingContract, "nsbtStakingSYSREADONLY", [userAddressStrOrEmpty, nsbtDiff], nil)) | |
152 | 176 | let gNsbtFromNsbtUser = nsbtUser | |
153 | 177 | let gNsbtFromNsbtTotal = nsbtTotal | |
154 | 178 | let surfData = asAnyList(invoke(surfStakingContract, "surfStakingSYSREADONLY", [userAddressStrOrEmpty, surfDiff], nil)) | |
155 | - | let surfUser = asInt(surfData[0]) | |
156 | - | let surfTotal = asInt(surfData[1]) | |
157 | - | let gNsbtFromSurfUser = asInt(surfData[2]) | |
158 | - | let gNsbtFromSurfTotal = asInt(surfData[3]) | |
159 | - | let vpEffectiveHeight = asInt(surfData[4]) | |
160 | - | let vpEffectiveHeightNEW = asInt(surfData[5]) | |
179 | + | let surfUser = asInt(surfData[IdxSurfUser]) | |
180 | + | let surfTotal = asInt(surfData[IdxSurfTotal]) | |
181 | + | let gNsbtFromSurfUser = asInt(surfData[IdxSurfGnsbtUser]) | |
182 | + | let gNsbtFromSurfTotal = asInt(surfData[IdxSurfGnsbtTotal]) | |
161 | 183 | let gNsbtUser = (gNsbtFromNsbtUser + gNsbtFromSurfUser) | |
162 | 184 | let gNsbtTotal = (gNsbtFromNsbtTotal + gNsbtFromSurfTotal) | |
163 | - | $Tuple2(nil, [gNsbtUser, gNsbtTotal, [nsbtUser, nsbtTotal, gNsbtFromNsbtUser, gNsbtFromNsbtTotal], [surfUser, surfTotal, gNsbtFromSurfUser, gNsbtFromSurfTotal], | |
185 | + | $Tuple2(nil, [gNsbtUser, gNsbtTotal, [nsbtUser, nsbtTotal, gNsbtFromNsbtUser, gNsbtFromNsbtTotal], [surfUser, surfTotal, gNsbtFromSurfUser, gNsbtFromSurfTotal], asInt(surfData[IdxSurfVpCurr]), asInt(surfData[IdxSurfVpNew]), asInt(surfData[IdxSurfTotalMature]), asInt(surfData[IdxSurfTotalTeen]), asInt(surfData[IdxSurfTotalKid]), asInt(surfData[IdxSurfUserMature]), asInt(surfData[IdxSurfUserTeen]), asInt(surfData[IdxSurfUserKid])]) | |
164 | 186 | } | |
165 | 187 | ||
166 | 188 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let revisionNum = "" | |
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_4C(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 | + | let IdxSurfUser = 0 | |
148 | + | ||
149 | + | let IdxSurfTotal = 1 | |
150 | + | ||
151 | + | let IdxSurfGnsbtUser = 2 | |
152 | + | ||
153 | + | let IdxSurfGnsbtTotal = 3 | |
154 | + | ||
155 | + | let IdxSurfVpCurr = 4 | |
156 | + | ||
157 | + | let IdxSurfVpNew = 5 | |
158 | + | ||
159 | + | let IdxSurfTotalMature = 6 | |
160 | + | ||
161 | + | let IdxSurfTotalTeen = 7 | |
162 | + | ||
163 | + | let IdxSurfTotalKid = 8 | |
164 | + | ||
165 | + | let IdxSurfUserMature = 9 | |
166 | + | ||
167 | + | let IdxSurfUserTeen = 10 | |
168 | + | ||
169 | + | let IdxSurfUserKid = 11 | |
170 | + | ||
147 | 171 | @Callable(i) | |
148 | 172 | func gnsbtInfoSYSREADONLY (userAddressStrOrEmpty,nsbtDiff,surfDiff) = { | |
149 | 173 | let nsbtData = asAnyList(invoke(nsbtStakingContract, "nsbtStakingSYSREADONLY", [userAddressStrOrEmpty, nsbtDiff], nil)) | |
150 | 174 | let nsbtUser = asInt(nsbtData[0]) | |
151 | 175 | let nsbtTotal = asInt(nsbtData[1]) | |
152 | 176 | let gNsbtFromNsbtUser = nsbtUser | |
153 | 177 | let gNsbtFromNsbtTotal = nsbtTotal | |
154 | 178 | let surfData = asAnyList(invoke(surfStakingContract, "surfStakingSYSREADONLY", [userAddressStrOrEmpty, surfDiff], nil)) | |
155 | - | let surfUser = asInt(surfData[0]) | |
156 | - | let surfTotal = asInt(surfData[1]) | |
157 | - | let gNsbtFromSurfUser = asInt(surfData[2]) | |
158 | - | let gNsbtFromSurfTotal = asInt(surfData[3]) | |
159 | - | let vpEffectiveHeight = asInt(surfData[4]) | |
160 | - | let vpEffectiveHeightNEW = asInt(surfData[5]) | |
179 | + | let surfUser = asInt(surfData[IdxSurfUser]) | |
180 | + | let surfTotal = asInt(surfData[IdxSurfTotal]) | |
181 | + | let gNsbtFromSurfUser = asInt(surfData[IdxSurfGnsbtUser]) | |
182 | + | let gNsbtFromSurfTotal = asInt(surfData[IdxSurfGnsbtTotal]) | |
161 | 183 | let gNsbtUser = (gNsbtFromNsbtUser + gNsbtFromSurfUser) | |
162 | 184 | let gNsbtTotal = (gNsbtFromNsbtTotal + gNsbtFromSurfTotal) | |
163 | - | $Tuple2(nil, [gNsbtUser, gNsbtTotal, [nsbtUser, nsbtTotal, gNsbtFromNsbtUser, gNsbtFromNsbtTotal], [surfUser, surfTotal, gNsbtFromSurfUser, gNsbtFromSurfTotal], | |
185 | + | $Tuple2(nil, [gNsbtUser, gNsbtTotal, [nsbtUser, nsbtTotal, gNsbtFromNsbtUser, gNsbtFromNsbtTotal], [surfUser, surfTotal, gNsbtFromSurfUser, gNsbtFromSurfTotal], asInt(surfData[IdxSurfVpCurr]), asInt(surfData[IdxSurfVpNew]), asInt(surfData[IdxSurfTotalMature]), asInt(surfData[IdxSurfTotalTeen]), asInt(surfData[IdxSurfTotalKid]), asInt(surfData[IdxSurfUserMature]), asInt(surfData[IdxSurfUserTeen]), asInt(surfData[IdxSurfUserKid])]) | |
164 | 186 | } | |
165 | 187 | ||
166 | 188 | ||
167 | 189 | ||
168 | 190 | @Callable(i) | |
169 | 191 | func claimRewards () = { | |
170 | 192 | let nsbtInv = asInt(invoke(nsbtStakingContract, "claimRewardsByOriginCaller", nil, nil)) | |
171 | 193 | let surfInv = asInt(invoke(surfStakingContract, "claimRewardsByOriginCaller", nil, nil)) | |
172 | 194 | if (((nsbtInv + surfInv) == 0)) | |
173 | 195 | then throw("Nothing to claim") | |
174 | 196 | else nil | |
175 | 197 | } | |
176 | 198 | ||
177 | 199 | ||
178 | 200 | ||
179 | 201 | @Callable(i) | |
180 | 202 | func gnsbtRewardsSYSREADONLY (userAddressStrOrEmpty) = { | |
181 | 203 | let nsbtRewardStr = asString(invoke(nsbtStakingContract, "unclaimedRewardsREADONLY", [userAddressStrOrEmpty], nil)) | |
182 | 204 | let surfRewardStr = asString(invoke(surfStakingContract, "unclaimedRewardsREADONLY", [userAddressStrOrEmpty], nil)) | |
183 | 205 | $Tuple2(nil, [nsbtRewardStr, surfRewardStr]) | |
184 | 206 | } | |
185 | 207 | ||
186 | 208 |
github/deemru/w8io/169f3d6 36.70 ms ◑