tx · 2Z2SgHS6pDspCAmDguJ14fuomG936f66N9ovpAFpnLEF 3N5NAftzfcw3gAt8nc35bNr9UdPTVgC81fd: -0.04000000 Waves 2022.08.09 19:47 [2177184] smart account 3N5NAftzfcw3gAt8nc35bNr9UdPTVgC81fd > SELF 0.00000000 Waves
{ "type": 13, "id": "2Z2SgHS6pDspCAmDguJ14fuomG936f66N9ovpAFpnLEF", "fee": 4000000, "feeAssetId": null, "timestamp": 1660063676460, "version": 1, "sender": "3N5NAftzfcw3gAt8nc35bNr9UdPTVgC81fd", "senderPublicKey": "CdnTmMHxT68Qa4MtHEnAiUhsdKTi2YkHPGn92ThinVNt", "proofs": [ "5iRLsfXuVKjmJxXHAJcyNh8DyJkHm3M2RGBNSPDUXJDARmSgfvUyDKs2WNxKXJAK4N43i9kG81vA1GKapoWbQ7wP", "3eFwYXC4g7qZpU8n5TiaRmqshePyV9UCRwB2BkPotMcAD1sqXkymDKNtTND8DBNCLHBv6WftD5h1DKLoszYimuRx", "5cJhY8v1hjCH4svGqz2QqAGcnNYkvpbhJgLMZCi7TtdzU95uppeubAYE6Yb8YvMjHmgtRRJe86UUogUEwpQSZwAu" ], "script": "base64:AAIFAAAAAAAAADEIAhIFCgMIAQESBQoDAQEIEgASABIDCgEIEgASABIAEgASBQoDAQEEEgMKAQESABIAAAAAbQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AgAAAAABAAAAFmdldEJvb2xCeUFkZHJlc3NBbmRLZXkAAAACAAAAB2FkZHJlc3MAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAAAACCQAEGwAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQcBAA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AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAgkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAIAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAwkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAMAAAAAAAAAAAIAAAAAAAAAAAAJAABnAAAAAgUAAAAFY291bnQAAAAAAAAAAAMVF031", "chainId": 84, "height": 2177184, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4hGF58kqxdwBsuwC3cP9gXh68bPAgRLzyENxw5wJK4SD Next: B1ERuQyd6dbVkUuRuUWj2Ly9G1SiD7yoLkkgrxr2yM7 Diff:
Old | New | Differences | |
---|---|---|---|
286 | 286 | ||
287 | 287 | ||
288 | 288 | @Callable(i) | |
289 | - | func constructorV2 (minWavesForSurfBuyKey,minUsdnForSurfBuyKey) = if ((i.caller != this)) | |
289 | + | func constructorV2 (minWavesForSurfBuyKey,minUsdnForSurfBuyKey,description) = if ((i.caller != this)) | |
290 | 290 | then throw("Permission denied") | |
291 | 291 | else { | |
292 | - | let issue = Issue("SURF", | |
292 | + | let issue = Issue("SURF", description, 0, 6, true, unit, 0) | |
293 | 293 | let assetId = calculateAssetId(issue) | |
294 | 294 | [issue, StringEntry(SurfAssetIdKey, toBase58String(assetId)), IntegerEntry(MinWavesForSurfBuyKey, minWavesForSurfBuyKey), IntegerEntry(MinUsdnForSurfBuyKey, minUsdnForSurfBuyKey)] | |
295 | 295 | } | |
390 | 390 | ||
391 | 391 | ||
392 | 392 | @Callable(i) | |
393 | - | func buySurf (averagePriceWanted,maxTolerancePerc,autoStake) = if ((size(i.payments) != 1)) | |
394 | - | then throw("exactly 1 payment must be attached") | |
395 | - | else if ((0 >= averagePriceWanted)) | |
396 | - | then throw("averagePriceWanted should be positive") | |
397 | - | else if ((0 >= maxTolerancePerc)) | |
398 | - | then throw("maxTolerancePerc should be positive") | |
399 | - | else { | |
400 | - | let pmt = i.payments[0] | |
401 | - | let amt = pmt.amount | |
402 | - | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
403 | - | if (if ((pmtAssetId != neutrinoAssetId)) | |
404 | - | then (pmtAssetId != WAVESID) | |
405 | - | else false) | |
406 | - | then throw("Unsupported payment asset") | |
407 | - | else if (if ((pmtAssetId == neutrinoAssetId)) | |
408 | - | then (minUsdnAmountSurfBuy > amt) | |
409 | - | else false) | |
410 | - | then throw((("min " + toString((minUsdnAmountSurfBuy / MULT6))) + " USDN expected")) | |
411 | - | else if (if ((pmtAssetId == WAVESID)) | |
412 | - | then (minWavesAmountSurfBuy > amt) | |
413 | - | else false) | |
414 | - | then throw((("min " + toString((minWavesAmountSurfBuy / MULT8))) + " WAVES expected")) | |
415 | - | else { | |
416 | - | let surfResult = asAnyList(invoke(mathContract, "surfFunctionREADONLY", [amt, pmtAssetId], nil)) | |
417 | - | let spentWaves = asInt(surfResult[bFuncIdxWaves]) | |
418 | - | let spentUsdn = asInt(surfResult[bFuncIdxUsdn]) | |
419 | - | let surfAmount = asInt(surfResult[bFuncIdxSurf]) | |
420 | - | let surfAmountX6 = toBigInt(surfAmount) | |
421 | - | let spentActualX18 = if ((pmtAssetId == WAVESID)) | |
422 | - | then (toBigInt(spentWaves) * MULTX10) | |
423 | - | else (toBigInt(spentUsdn) * MULTX12) | |
424 | - | if ((spentActualX18 > ((toBigInt((maxTolerancePerc + MULT6)) * toBigInt(averagePriceWanted)) * surfAmountX6))) | |
425 | - | then throw((((((("Tolerance " + toString(maxTolerancePerc)) + " exceeded: spent ") + (if ((pmtAssetId == WAVESID)) | |
426 | - | then (toString(spentWaves) + " WAVES") | |
427 | - | else (toString(spentUsdn) + " USDN"))) + " for ") + toString(surfAmount)) + " SURF")) | |
428 | - | else { | |
429 | - | let rest = asInt(surfResult[bFuncIdxRest]) | |
430 | - | let transfer = if ((pmtAssetId == WAVESID)) | |
431 | - | then { | |
432 | - | let wavesAmt = invoke(neutrinoContract, "acceptWaves", nil, [AttachedPayment(unit, (amt - rest))]) | |
433 | - | if ((wavesAmt == wavesAmt)) | |
434 | - | then if ((rest > 0)) | |
435 | - | then [ScriptTransfer(i.caller, rest, unit)] | |
436 | - | else nil | |
437 | - | else throw("Strict value is not equal to itself.") | |
438 | - | } | |
439 | - | else if ((rest > 0)) | |
440 | - | then [ScriptTransfer(neutrinoContract, (amt - rest), neutrinoAssetId), ScriptTransfer(i.caller, rest, neutrinoAssetId)] | |
441 | - | else [ScriptTransfer(neutrinoContract, (amt - rest), neutrinoAssetId)] | |
442 | - | let surfAssetId = asBytes(invoke(this, "issueSurf", [surfAmount], nil)) | |
443 | - | let surfAction = if (autoStake) | |
444 | - | then { | |
445 | - | let stakingInv = invoke(surfStakingContract, "stakeByOriginCaller", nil, [AttachedPayment(surfAssetId, surfAmount)]) | |
446 | - | if ((stakingInv == stakingInv)) | |
447 | - | then nil | |
448 | - | else throw("Strict value is not equal to itself.") | |
449 | - | } | |
450 | - | else [ScriptTransfer(i.caller, surfAmount, surfAssetId)] | |
451 | - | ((transfer ++ [surfData(surfResult)]) ++ surfAction) | |
452 | - | } | |
453 | - | } | |
454 | - | } | |
393 | + | func buySurf (averagePriceWanted,maxTolerancePerc,autoStake) = { | |
394 | + | let testAccounts = valueOrElse(getString(this, "testAccounts"), "") | |
395 | + | if (if ((testAccounts != "")) | |
396 | + | then !(contains(testAccounts, toString(i.caller))) | |
397 | + | else false) | |
398 | + | then throw("Be patient! Need to test in mainnet before launch.") | |
399 | + | else if ((size(i.payments) != 1)) | |
400 | + | then throw("exactly 1 payment must be attached") | |
401 | + | else if ((0 >= averagePriceWanted)) | |
402 | + | then throw("averagePriceWanted should be positive") | |
403 | + | else if ((0 >= maxTolerancePerc)) | |
404 | + | then throw("maxTolerancePerc should be positive") | |
405 | + | else if (isBlocked) | |
406 | + | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
407 | + | else { | |
408 | + | let pmt = i.payments[0] | |
409 | + | let amt = pmt.amount | |
410 | + | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
411 | + | if (if ((pmtAssetId != neutrinoAssetId)) | |
412 | + | then (pmtAssetId != WAVESID) | |
413 | + | else false) | |
414 | + | then throw("Unsupported payment asset") | |
415 | + | else if (if ((pmtAssetId == neutrinoAssetId)) | |
416 | + | then (minUsdnAmountSurfBuy > amt) | |
417 | + | else false) | |
418 | + | then throw((("min " + toString((minUsdnAmountSurfBuy / MULT6))) + " USDN expected")) | |
419 | + | else if (if ((pmtAssetId == WAVESID)) | |
420 | + | then (minWavesAmountSurfBuy > amt) | |
421 | + | else false) | |
422 | + | then throw((("min " + toString((minWavesAmountSurfBuy / MULT8))) + " WAVES expected")) | |
423 | + | else { | |
424 | + | let surfResult = asAnyList(invoke(mathContract, "surfFunctionREADONLY", [amt, pmtAssetId], nil)) | |
425 | + | let spentWaves = asInt(surfResult[bFuncIdxWaves]) | |
426 | + | let spentUsdn = asInt(surfResult[bFuncIdxUsdn]) | |
427 | + | let surfAmount = asInt(surfResult[bFuncIdxSurf]) | |
428 | + | let surfAmountX6 = toBigInt(surfAmount) | |
429 | + | let spentActualX18 = if ((pmtAssetId == WAVESID)) | |
430 | + | then (toBigInt(spentWaves) * MULTX10) | |
431 | + | else (toBigInt(spentUsdn) * MULTX12) | |
432 | + | if ((spentActualX18 > ((toBigInt((maxTolerancePerc + MULT6)) * toBigInt(averagePriceWanted)) * surfAmountX6))) | |
433 | + | then throw((((((("Tolerance " + toString(maxTolerancePerc)) + " exceeded: spent ") + (if ((pmtAssetId == WAVESID)) | |
434 | + | then (toString(spentWaves) + " WAVES") | |
435 | + | else (toString(spentUsdn) + " USDN"))) + " for ") + toString(surfAmount)) + " SURF")) | |
436 | + | else { | |
437 | + | let rest = asInt(surfResult[bFuncIdxRest]) | |
438 | + | let transfer = if ((pmtAssetId == WAVESID)) | |
439 | + | then { | |
440 | + | let wavesAmt = invoke(neutrinoContract, "acceptWaves", nil, [AttachedPayment(unit, (amt - rest))]) | |
441 | + | if ((wavesAmt == wavesAmt)) | |
442 | + | then if ((rest > 0)) | |
443 | + | then [ScriptTransfer(i.caller, rest, unit)] | |
444 | + | else nil | |
445 | + | else throw("Strict value is not equal to itself.") | |
446 | + | } | |
447 | + | else if ((rest > 0)) | |
448 | + | then [ScriptTransfer(neutrinoContract, (amt - rest), neutrinoAssetId), ScriptTransfer(i.caller, rest, neutrinoAssetId)] | |
449 | + | else [ScriptTransfer(neutrinoContract, (amt - rest), neutrinoAssetId)] | |
450 | + | let surfAssetId = asBytes(invoke(this, "issueSurf", [surfAmount], nil)) | |
451 | + | let surfAction = if (autoStake) | |
452 | + | then { | |
453 | + | let stakingInv = invoke(surfStakingContract, "stakeByOriginCaller", nil, [AttachedPayment(surfAssetId, surfAmount)]) | |
454 | + | if ((stakingInv == stakingInv)) | |
455 | + | then nil | |
456 | + | else throw("Strict value is not equal to itself.") | |
457 | + | } | |
458 | + | else [ScriptTransfer(i.caller, surfAmount, surfAssetId)] | |
459 | + | ((transfer ++ [surfData(surfResult)]) ++ surfAction) | |
460 | + | } | |
461 | + | } | |
462 | + | } | |
463 | + | } | |
455 | 464 | ||
456 | 465 | ||
457 | 466 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func getBoolByAddressAndKey (address,key) = valueOrElse(getBoolean(address, key), false) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func getStringByAddressAndKey (address,key) = valueOrElse(getString(address, key), "") | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func getNumberByAddressAndKey (address,key) = valueOrElse(getInteger(address, key), 0) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func asAnyList (val) = match val { | |
20 | 20 | case valAnyLyst: List[Any] => | |
21 | 21 | valAnyLyst | |
22 | 22 | case _ => | |
23 | 23 | throw("fail to cast into List[Any]") | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func asString (val) = match val { | |
28 | 28 | case valStr: String => | |
29 | 29 | valStr | |
30 | 30 | case _ => | |
31 | 31 | throw("fail to cast into String") | |
32 | 32 | } | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func asInt (val) = match val { | |
36 | 36 | case valInt: Int => | |
37 | 37 | valInt | |
38 | 38 | case _ => | |
39 | 39 | throw("fail to cast into Int") | |
40 | 40 | } | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func asBytes (val) = match val { | |
44 | 44 | case valByte: ByteVector => | |
45 | 45 | valByte | |
46 | 46 | case _ => | |
47 | 47 | throw("fail to cast into Int") | |
48 | 48 | } | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | let SEP = "__" | |
52 | 52 | ||
53 | 53 | let MULT6 = 1000000 | |
54 | 54 | ||
55 | 55 | let MULT8 = 100000000 | |
56 | 56 | ||
57 | 57 | let MULTX10 = toBigInt(10000000000) | |
58 | 58 | ||
59 | 59 | let MULTX12 = toBigInt(1000000000000) | |
60 | 60 | ||
61 | 61 | let MULTX16 = toBigInt(10000000000000000) | |
62 | 62 | ||
63 | 63 | let CANCELED = "canceled" | |
64 | 64 | ||
65 | 65 | let NEW = "new" | |
66 | 66 | ||
67 | 67 | let FILLED = "filled" | |
68 | 68 | ||
69 | 69 | let WAVESID = fromBase58String("WAVES") | |
70 | 70 | ||
71 | 71 | let nMetricIdxPrice = 0 | |
72 | 72 | ||
73 | 73 | let nMetricIdxUsdnLockedBalance = 1 | |
74 | 74 | ||
75 | 75 | let nMetricIdxWavesLockedBalance = 2 | |
76 | 76 | ||
77 | 77 | let nMetricIdxReserve = 3 | |
78 | 78 | ||
79 | 79 | let nMetricIdxReserveInUsdn = 4 | |
80 | 80 | ||
81 | 81 | let nMetricIdxUsdnSupply = 5 | |
82 | 82 | ||
83 | 83 | let nMetricIdxSurplus = 6 | |
84 | 84 | ||
85 | 85 | let nMetricIdxSurplusPercent = 7 | |
86 | 86 | ||
87 | 87 | let nMetricIdxBR = 8 | |
88 | 88 | ||
89 | 89 | let nMetricIdxNsbtSupply = 9 | |
90 | 90 | ||
91 | 91 | let nMetricIdxMaxNsbtSupply = 10 | |
92 | 92 | ||
93 | 93 | let nMetricIdxSurfSupply = 11 | |
94 | 94 | ||
95 | 95 | let bFuncIdxSurf = 0 | |
96 | 96 | ||
97 | 97 | let bFuncIdxWaves = 1 | |
98 | 98 | ||
99 | 99 | let bFuncIdxUsdn = 2 | |
100 | 100 | ||
101 | 101 | let bFuncIdxReserveStart = 3 | |
102 | 102 | ||
103 | 103 | let bFuncIdxSupplyStart = 4 | |
104 | 104 | ||
105 | 105 | let bFuncIdxBRStart = 5 | |
106 | 106 | ||
107 | 107 | let bFuncIdxReserveEnd = 6 | |
108 | 108 | ||
109 | 109 | let bFuncIdxSupplyEnd = 7 | |
110 | 110 | ||
111 | 111 | let bFuncIdxBREnd = 8 | |
112 | 112 | ||
113 | 113 | let bFuncIdxRest = 9 | |
114 | 114 | ||
115 | 115 | let bFuncIdxWavesPrice = 10 | |
116 | 116 | ||
117 | 117 | let IdxControlCfgNeutrinoDapp = 1 | |
118 | 118 | ||
119 | 119 | let IdxControlCfgAuctionDapp = 2 | |
120 | 120 | ||
121 | 121 | let IdxControlCfgRpdDapp = 3 | |
122 | 122 | ||
123 | 123 | let IdxControlCfgMathDapp = 4 | |
124 | 124 | ||
125 | 125 | let IdxControlCfgLiquidationDapp = 5 | |
126 | 126 | ||
127 | 127 | let IdxControlCfgRestDapp = 6 | |
128 | 128 | ||
129 | 129 | let IdxControlCfgNodeRegistryDapp = 7 | |
130 | 130 | ||
131 | 131 | let IdxControlCfgNsbtStakingDapp = 8 | |
132 | 132 | ||
133 | 133 | let IdxControlCfgMediatorDapp = 9 | |
134 | 134 | ||
135 | 135 | let IdxControlCfgSurfStakingDapp = 10 | |
136 | 136 | ||
137 | 137 | let IdxControlCfgGnsbtControllerDapp = 11 | |
138 | 138 | ||
139 | 139 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func keyControlAddress () = "%s%s__config__controlAddress" | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func keyControlCfg () = "%s__controlConfig" | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func readControlCfgOrFail (control) = split(getStringOrFail(control, keyControlCfg()), SEP) | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx))) | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")) | |
155 | 155 | ||
156 | 156 | let controlCfg = readControlCfgOrFail(controlContract) | |
157 | 157 | ||
158 | 158 | let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp) | |
159 | 159 | ||
160 | 160 | let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp) | |
161 | 161 | ||
162 | 162 | let surfStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgSurfStakingDapp) | |
163 | 163 | ||
164 | 164 | let PriceKey = "price" | |
165 | 165 | ||
166 | 166 | let NsbtAssetIdKey = "bond_asset_id" | |
167 | 167 | ||
168 | 168 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
169 | 169 | ||
170 | 170 | let SurfAssetIdKey = "surf_asset_id" | |
171 | 171 | ||
172 | 172 | let BalanceLockedkKey = "balance_lock_" | |
173 | 173 | ||
174 | 174 | let WavesLockedBalanceKey = (BalanceLockedkKey + "waves") | |
175 | 175 | ||
176 | 176 | let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino") | |
177 | 177 | ||
178 | 178 | let FirstOrderKey = "order_first" | |
179 | 179 | ||
180 | 180 | let MathContractKey = "math_contract" | |
181 | 181 | ||
182 | 182 | let MinWavesForNsbtBuyKey = "min_waves_nsbt_buy" | |
183 | 183 | ||
184 | 184 | let MinNsbtSellKey = "min_nsbt_sell" | |
185 | 185 | ||
186 | 186 | let MinWavesForSurfBuyKey = "min_waves_surf_buy" | |
187 | 187 | ||
188 | 188 | let MinUsdnForSurfBuyKey = "min_usdn_surf_buy" | |
189 | 189 | ||
190 | 190 | func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId) | |
191 | 191 | ||
192 | 192 | ||
193 | 193 | func getOrderPriceKey (orderId) = ("order_price_" + orderId) | |
194 | 194 | ||
195 | 195 | ||
196 | 196 | func getOrderTotalKey (orderId) = ("order_total_" + orderId) | |
197 | 197 | ||
198 | 198 | ||
199 | 199 | func getOrderOwnerKey (orderId) = ("order_owner_" + orderId) | |
200 | 200 | ||
201 | 201 | ||
202 | 202 | func getOrderHeightKey (orderId) = ("order_height_" + orderId) | |
203 | 203 | ||
204 | 204 | ||
205 | 205 | func getOrderStatusKey (orderId) = ("order_status_" + orderId) | |
206 | 206 | ||
207 | 207 | ||
208 | 208 | func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId) | |
209 | 209 | ||
210 | 210 | ||
211 | 211 | func getPrevOrderKey (orderId) = ("order_prev_" + orderId) | |
212 | 212 | ||
213 | 213 | ||
214 | 214 | func getNextOrderKey (orderId) = ("order_next_" + orderId) | |
215 | 215 | ||
216 | 216 | ||
217 | 217 | func convertNeutrinoToWaves (amount,price) = fraction(amount, MULT8, price) | |
218 | 218 | ||
219 | 219 | ||
220 | 220 | func convertWavesToNeutrino (amount,price) = fraction(amount, price, MULT8) | |
221 | 221 | ||
222 | 222 | ||
223 | 223 | func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), MULTX16, toBigInt(origScaleMult)) | |
224 | 224 | ||
225 | 225 | ||
226 | 226 | func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), MULTX16)) | |
227 | 227 | ||
228 | 228 | ||
229 | 229 | let neutrinoAssetId = base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ' | |
230 | 230 | ||
231 | 231 | let nsbtAssetId = base58'F3iaxzruFeKujfVfYSZEkejpjh67wmRfPCRHiNmWKp3Z' | |
232 | 232 | ||
233 | 233 | let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked") | |
234 | 234 | ||
235 | 235 | let minWavesAmountNsbtBuy = valueOrElse(getInteger(this, MinWavesForNsbtBuyKey), 1000000000) | |
236 | 236 | ||
237 | 237 | let minNsbtSell = valueOrElse(getInteger(this, MinNsbtSellKey), 1000000) | |
238 | 238 | ||
239 | 239 | let minWavesAmountSurfBuy = valueOrElse(getInteger(this, MinWavesForSurfBuyKey), 100000000) | |
240 | 240 | ||
241 | 241 | let minUsdnAmountSurfBuy = valueOrElse(getInteger(this, MinUsdnForSurfBuyKey), 10000000) | |
242 | 242 | ||
243 | 243 | let firstOrder = getStringByKey(FirstOrderKey) | |
244 | 244 | ||
245 | 245 | func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id)) | |
246 | 246 | ||
247 | 247 | ||
248 | 248 | func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id)) | |
249 | 249 | ||
250 | 250 | ||
251 | 251 | func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id)) | |
252 | 252 | ||
253 | 253 | ||
254 | 254 | func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id)) | |
255 | 255 | ||
256 | 256 | ||
257 | 257 | func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id)) | |
258 | 258 | ||
259 | 259 | ||
260 | 260 | func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id)) | |
261 | 261 | ||
262 | 262 | ||
263 | 263 | func getNextOrder (id) = getStringByKey(getNextOrderKey(id)) | |
264 | 264 | ||
265 | 265 | ||
266 | 266 | func getReversePrice (price) = ((MULT6 * MULT6) / price) | |
267 | 267 | ||
268 | 268 | ||
269 | 269 | func calcNsbt2WavesPriceRaw (spentWavesRaw,receivedNsbtRaw) = fraction(toBigInt(spentWavesRaw), toBigInt((MULT6 * MULT6)), toBigInt(receivedNsbtRaw)) | |
270 | 270 | ||
271 | 271 | ||
272 | 272 | func orderData (orderId,totalWavelets,filledWavelets,owner,status,roi,price,currentPrice) = [StringEntry(getOrderPriceKey(orderId), toString(price)), IntegerEntry(getOrderTotalKey(orderId), totalWavelets), IntegerEntry(getOrderFilledTotalKey(orderId), filledWavelets), StringEntry(getOrderOwnerKey(orderId), owner), IntegerEntry(getOrderHeightKey(orderId), height), StringEntry(getOrderStatusKey(orderId), status), IntegerEntry(("debug_order_currentPrice_" + orderId), currentPrice), IntegerEntry(getRoiByOrderIdKey(orderId), roi)] | |
273 | 273 | ||
274 | 274 | ||
275 | 275 | func toStr (name,curveResult) = (((((((((((((((((((((((((((((((((((name + "[nsbtAmountRaw=") + toString(asInt(curveResult[0]))) + " usdnPayment=") + toString(asInt(curveResult[1]))) + " wRaw=") + toString(asInt(curveResult[2]))) + " uRaw=") + toString(asInt(curveResult[3]))) + " mRaw=") + toString(asInt(curveResult[4]))) + " sRaw=") + toString(asInt(curveResult[5]))) + " nsbtCurveParam_a=") + toString(asInt(curveResult[6]))) + " nsbtCurveParam_b=") + toString(asInt(curveResult[7]))) + " wReservesInUsdn=") + toString(asInt(curveResult[8]))) + " price=") + toString(asInt(curveResult[9]))) + " multBR=") + toString(asInt(curveResult[10]))) + " multPower=") + toString(asInt(curveResult[11]))) + " multExpInPower=") + asString(curveResult[12])) + " multK=") + asString(curveResult[13])) + " step1=") + asString(curveResult[14])) + " step2=") + asString(curveResult[15])) + " step3=") + toString(asInt(curveResult[16]))) + "]") | |
276 | 276 | ||
277 | 277 | ||
278 | 278 | func surfData (surfResult) = StringEntry("debug_surfResult", makeString(["%d%d%d%d%d%d%d%d%d%d%d", toString(asInt(surfResult[bFuncIdxSurf])), toString(asInt(surfResult[bFuncIdxWaves])), toString(asInt(surfResult[bFuncIdxUsdn])), toString(asInt(surfResult[bFuncIdxReserveStart])), toString(asInt(surfResult[bFuncIdxSupplyStart])), toString(asInt(surfResult[bFuncIdxBRStart])), toString(asInt(surfResult[bFuncIdxReserveEnd])), toString(asInt(surfResult[bFuncIdxSupplyEnd])), toString(asInt(surfResult[bFuncIdxBREnd])), toString(asInt(surfResult[bFuncIdxRest])), toString(asInt(surfResult[bFuncIdxWavesPrice]))], SEP)) | |
279 | 279 | ||
280 | 280 | ||
281 | 281 | @Callable(i) | |
282 | 282 | func constructor (mathContractAddress,minWavesForNsbtBuy,minNsbtSell) = if ((i.caller != this)) | |
283 | 283 | then throw("Permission denied") | |
284 | 284 | else [StringEntry(MathContractKey, mathContractAddress), IntegerEntry(MinNsbtSellKey, minNsbtSell), IntegerEntry(MinWavesForNsbtBuyKey, minWavesForNsbtBuy)] | |
285 | 285 | ||
286 | 286 | ||
287 | 287 | ||
288 | 288 | @Callable(i) | |
289 | - | func constructorV2 (minWavesForSurfBuyKey,minUsdnForSurfBuyKey) = if ((i.caller != this)) | |
289 | + | func constructorV2 (minWavesForSurfBuyKey,minUsdnForSurfBuyKey,description) = if ((i.caller != this)) | |
290 | 290 | then throw("Permission denied") | |
291 | 291 | else { | |
292 | - | let issue = Issue("SURF", | |
292 | + | let issue = Issue("SURF", description, 0, 6, true, unit, 0) | |
293 | 293 | let assetId = calculateAssetId(issue) | |
294 | 294 | [issue, StringEntry(SurfAssetIdKey, toBase58String(assetId)), IntegerEntry(MinWavesForSurfBuyKey, minWavesForSurfBuyKey), IntegerEntry(MinUsdnForSurfBuyKey, minUsdnForSurfBuyKey)] | |
295 | 295 | } | |
296 | 296 | ||
297 | 297 | ||
298 | 298 | ||
299 | 299 | @Callable(i) | |
300 | 300 | func buyNsbt () = { | |
301 | 301 | let pmt = value(i.payments[0]) | |
302 | 302 | let pmtAmount = pmt.amount | |
303 | 303 | let wavesPay = pmtAmount | |
304 | 304 | if (isBlocked) | |
305 | 305 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
306 | 306 | else if (isDefined(pmt.assetId)) | |
307 | 307 | then throw("can use waves only") | |
308 | 308 | else if ((minWavesAmountNsbtBuy > pmtAmount)) | |
309 | 309 | then throw((("min " + toString((minWavesAmountNsbtBuy / MULT8))) + " waves expected")) | |
310 | 310 | else { | |
311 | 311 | let ownerAddress = i.caller | |
312 | 312 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
313 | 313 | let currentPrice = asInt(neutrinoMetrics[0]) | |
314 | 314 | let curveResult = asAnyList(invoke(mathContract, "curveFunctionREADONLY", [wavesPay], nil)) | |
315 | 315 | let nsbtAmount = asInt(curveResult[0]) | |
316 | 316 | if ((0 >= nsbtAmount)) | |
317 | 317 | then throw("nsbtAmount <= 0") | |
318 | 318 | else { | |
319 | 319 | let nsbt2WavesPriceRaw = calcNsbt2WavesPriceRaw(wavesPay, nsbtAmount) | |
320 | 320 | let roi = 0 | |
321 | 321 | let amountLeased = invoke(neutrinoContract, "acceptWaves", nil, i.payments) | |
322 | 322 | if ((amountLeased == amountLeased)) | |
323 | 323 | then $Tuple2((orderData(toBase58String(i.transactionId), pmtAmount, pmtAmount, toString(ownerAddress), FILLED, roi, nsbt2WavesPriceRaw, currentPrice) ++ [ScriptTransfer(ownerAddress, nsbtAmount, nsbtAssetId), StringEntry("debug_curveResult", toStr("curveResult", curveResult))]), nsbtAmount) | |
324 | 324 | else throw("Strict value is not equal to itself.") | |
325 | 325 | } | |
326 | 326 | } | |
327 | 327 | } | |
328 | 328 | ||
329 | 329 | ||
330 | 330 | ||
331 | 331 | @Callable(i) | |
332 | 332 | func sellNsbt () = if (isBlocked) | |
333 | 333 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
334 | 334 | else { | |
335 | 335 | let pmt = value(i.payments[0]) | |
336 | 336 | let pmtAmount = pmt.amount | |
337 | 337 | if ((pmt.assetId != nsbtAssetId)) | |
338 | 338 | then throw("can use NSBT only") | |
339 | 339 | else if ((minNsbtSell > pmtAmount)) | |
340 | 340 | then throw((("min " + toString((minNsbtSell / MULT6))) + " nsbt expected")) | |
341 | 341 | else { | |
342 | 342 | let newPrice = asInt(asAnyList(invoke(mathContract, "calcContractNsbtPriceSYSREADONLY", [-(pmtAmount)], nil))[0]) | |
343 | 343 | if ((MULT6 > newPrice)) | |
344 | 344 | then throw((("resulting nsbt price would be < 1 (" + toString(newPrice)) + " usdn)")) | |
345 | 345 | else { | |
346 | 346 | let transf = invoke(neutrinoContract, "transferUsdnToUser", [pmtAmount, toString(i.caller)], nil) | |
347 | 347 | if ((transf == transf)) | |
348 | 348 | then $Tuple2(nil, newPrice) | |
349 | 349 | else throw("Strict value is not equal to itself.") | |
350 | 350 | } | |
351 | 351 | } | |
352 | 352 | } | |
353 | 353 | ||
354 | 354 | ||
355 | 355 | ||
356 | 356 | @Callable(i) | |
357 | 357 | func cancelOrder (orderId) = { | |
358 | 358 | let owner = getOrderOwner(orderId) | |
359 | 359 | let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId)) | |
360 | 360 | let caller = toString(i.caller) | |
361 | 361 | let nextOrder = getNextOrder(orderId) | |
362 | 362 | let prevOrder = getPrevOrder(orderId) | |
363 | 363 | if ((getOrderStatus(orderId) != NEW)) | |
364 | 364 | then throw("invalid order status") | |
365 | 365 | else [StringEntry(FirstOrderKey, if ((firstOrder == orderId)) | |
366 | 366 | then nextOrder | |
367 | 367 | else firstOrder), StringEntry(getNextOrderKey(prevOrder), nextOrder), StringEntry(getPrevOrderKey(nextOrder), prevOrder), StringEntry(getOrderStatusKey(orderId), CANCELED), ScriptTransfer(i.caller, amount, unit)] | |
368 | 368 | } | |
369 | 369 | ||
370 | 370 | ||
371 | 371 | ||
372 | 372 | @Callable(i) | |
373 | 373 | func minWavesAmountNsbtBuySYSREADONLY () = $Tuple2(nil, minWavesAmountNsbtBuy) | |
374 | 374 | ||
375 | 375 | ||
376 | 376 | ||
377 | 377 | @Callable(i) | |
378 | 378 | func minNsbtAmountForSellSYSREADONLY () = $Tuple2(nil, minNsbtSell) | |
379 | 379 | ||
380 | 380 | ||
381 | 381 | ||
382 | 382 | @Callable(i) | |
383 | 383 | func minWavesAmountSurfBuySYSREADONLY () = $Tuple2(nil, minWavesAmountSurfBuy) | |
384 | 384 | ||
385 | 385 | ||
386 | 386 | ||
387 | 387 | @Callable(i) | |
388 | 388 | func minUsdnAmountSurfBuySYSREADONLY () = $Tuple2(nil, minUsdnAmountSurfBuy) | |
389 | 389 | ||
390 | 390 | ||
391 | 391 | ||
392 | 392 | @Callable(i) | |
393 | - | func buySurf (averagePriceWanted,maxTolerancePerc,autoStake) = if ((size(i.payments) != 1)) | |
394 | - | then throw("exactly 1 payment must be attached") | |
395 | - | else if ((0 >= averagePriceWanted)) | |
396 | - | then throw("averagePriceWanted should be positive") | |
397 | - | else if ((0 >= maxTolerancePerc)) | |
398 | - | then throw("maxTolerancePerc should be positive") | |
399 | - | else { | |
400 | - | let pmt = i.payments[0] | |
401 | - | let amt = pmt.amount | |
402 | - | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
403 | - | if (if ((pmtAssetId != neutrinoAssetId)) | |
404 | - | then (pmtAssetId != WAVESID) | |
405 | - | else false) | |
406 | - | then throw("Unsupported payment asset") | |
407 | - | else if (if ((pmtAssetId == neutrinoAssetId)) | |
408 | - | then (minUsdnAmountSurfBuy > amt) | |
409 | - | else false) | |
410 | - | then throw((("min " + toString((minUsdnAmountSurfBuy / MULT6))) + " USDN expected")) | |
411 | - | else if (if ((pmtAssetId == WAVESID)) | |
412 | - | then (minWavesAmountSurfBuy > amt) | |
413 | - | else false) | |
414 | - | then throw((("min " + toString((minWavesAmountSurfBuy / MULT8))) + " WAVES expected")) | |
415 | - | else { | |
416 | - | let surfResult = asAnyList(invoke(mathContract, "surfFunctionREADONLY", [amt, pmtAssetId], nil)) | |
417 | - | let spentWaves = asInt(surfResult[bFuncIdxWaves]) | |
418 | - | let spentUsdn = asInt(surfResult[bFuncIdxUsdn]) | |
419 | - | let surfAmount = asInt(surfResult[bFuncIdxSurf]) | |
420 | - | let surfAmountX6 = toBigInt(surfAmount) | |
421 | - | let spentActualX18 = if ((pmtAssetId == WAVESID)) | |
422 | - | then (toBigInt(spentWaves) * MULTX10) | |
423 | - | else (toBigInt(spentUsdn) * MULTX12) | |
424 | - | if ((spentActualX18 > ((toBigInt((maxTolerancePerc + MULT6)) * toBigInt(averagePriceWanted)) * surfAmountX6))) | |
425 | - | then throw((((((("Tolerance " + toString(maxTolerancePerc)) + " exceeded: spent ") + (if ((pmtAssetId == WAVESID)) | |
426 | - | then (toString(spentWaves) + " WAVES") | |
427 | - | else (toString(spentUsdn) + " USDN"))) + " for ") + toString(surfAmount)) + " SURF")) | |
428 | - | else { | |
429 | - | let rest = asInt(surfResult[bFuncIdxRest]) | |
430 | - | let transfer = if ((pmtAssetId == WAVESID)) | |
431 | - | then { | |
432 | - | let wavesAmt = invoke(neutrinoContract, "acceptWaves", nil, [AttachedPayment(unit, (amt - rest))]) | |
433 | - | if ((wavesAmt == wavesAmt)) | |
434 | - | then if ((rest > 0)) | |
435 | - | then [ScriptTransfer(i.caller, rest, unit)] | |
436 | - | else nil | |
437 | - | else throw("Strict value is not equal to itself.") | |
438 | - | } | |
439 | - | else if ((rest > 0)) | |
440 | - | then [ScriptTransfer(neutrinoContract, (amt - rest), neutrinoAssetId), ScriptTransfer(i.caller, rest, neutrinoAssetId)] | |
441 | - | else [ScriptTransfer(neutrinoContract, (amt - rest), neutrinoAssetId)] | |
442 | - | let surfAssetId = asBytes(invoke(this, "issueSurf", [surfAmount], nil)) | |
443 | - | let surfAction = if (autoStake) | |
444 | - | then { | |
445 | - | let stakingInv = invoke(surfStakingContract, "stakeByOriginCaller", nil, [AttachedPayment(surfAssetId, surfAmount)]) | |
446 | - | if ((stakingInv == stakingInv)) | |
447 | - | then nil | |
448 | - | else throw("Strict value is not equal to itself.") | |
449 | - | } | |
450 | - | else [ScriptTransfer(i.caller, surfAmount, surfAssetId)] | |
451 | - | ((transfer ++ [surfData(surfResult)]) ++ surfAction) | |
452 | - | } | |
453 | - | } | |
454 | - | } | |
393 | + | func buySurf (averagePriceWanted,maxTolerancePerc,autoStake) = { | |
394 | + | let testAccounts = valueOrElse(getString(this, "testAccounts"), "") | |
395 | + | if (if ((testAccounts != "")) | |
396 | + | then !(contains(testAccounts, toString(i.caller))) | |
397 | + | else false) | |
398 | + | then throw("Be patient! Need to test in mainnet before launch.") | |
399 | + | else if ((size(i.payments) != 1)) | |
400 | + | then throw("exactly 1 payment must be attached") | |
401 | + | else if ((0 >= averagePriceWanted)) | |
402 | + | then throw("averagePriceWanted should be positive") | |
403 | + | else if ((0 >= maxTolerancePerc)) | |
404 | + | then throw("maxTolerancePerc should be positive") | |
405 | + | else if (isBlocked) | |
406 | + | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
407 | + | else { | |
408 | + | let pmt = i.payments[0] | |
409 | + | let amt = pmt.amount | |
410 | + | let pmtAssetId = valueOrElse(pmt.assetId, WAVESID) | |
411 | + | if (if ((pmtAssetId != neutrinoAssetId)) | |
412 | + | then (pmtAssetId != WAVESID) | |
413 | + | else false) | |
414 | + | then throw("Unsupported payment asset") | |
415 | + | else if (if ((pmtAssetId == neutrinoAssetId)) | |
416 | + | then (minUsdnAmountSurfBuy > amt) | |
417 | + | else false) | |
418 | + | then throw((("min " + toString((minUsdnAmountSurfBuy / MULT6))) + " USDN expected")) | |
419 | + | else if (if ((pmtAssetId == WAVESID)) | |
420 | + | then (minWavesAmountSurfBuy > amt) | |
421 | + | else false) | |
422 | + | then throw((("min " + toString((minWavesAmountSurfBuy / MULT8))) + " WAVES expected")) | |
423 | + | else { | |
424 | + | let surfResult = asAnyList(invoke(mathContract, "surfFunctionREADONLY", [amt, pmtAssetId], nil)) | |
425 | + | let spentWaves = asInt(surfResult[bFuncIdxWaves]) | |
426 | + | let spentUsdn = asInt(surfResult[bFuncIdxUsdn]) | |
427 | + | let surfAmount = asInt(surfResult[bFuncIdxSurf]) | |
428 | + | let surfAmountX6 = toBigInt(surfAmount) | |
429 | + | let spentActualX18 = if ((pmtAssetId == WAVESID)) | |
430 | + | then (toBigInt(spentWaves) * MULTX10) | |
431 | + | else (toBigInt(spentUsdn) * MULTX12) | |
432 | + | if ((spentActualX18 > ((toBigInt((maxTolerancePerc + MULT6)) * toBigInt(averagePriceWanted)) * surfAmountX6))) | |
433 | + | then throw((((((("Tolerance " + toString(maxTolerancePerc)) + " exceeded: spent ") + (if ((pmtAssetId == WAVESID)) | |
434 | + | then (toString(spentWaves) + " WAVES") | |
435 | + | else (toString(spentUsdn) + " USDN"))) + " for ") + toString(surfAmount)) + " SURF")) | |
436 | + | else { | |
437 | + | let rest = asInt(surfResult[bFuncIdxRest]) | |
438 | + | let transfer = if ((pmtAssetId == WAVESID)) | |
439 | + | then { | |
440 | + | let wavesAmt = invoke(neutrinoContract, "acceptWaves", nil, [AttachedPayment(unit, (amt - rest))]) | |
441 | + | if ((wavesAmt == wavesAmt)) | |
442 | + | then if ((rest > 0)) | |
443 | + | then [ScriptTransfer(i.caller, rest, unit)] | |
444 | + | else nil | |
445 | + | else throw("Strict value is not equal to itself.") | |
446 | + | } | |
447 | + | else if ((rest > 0)) | |
448 | + | then [ScriptTransfer(neutrinoContract, (amt - rest), neutrinoAssetId), ScriptTransfer(i.caller, rest, neutrinoAssetId)] | |
449 | + | else [ScriptTransfer(neutrinoContract, (amt - rest), neutrinoAssetId)] | |
450 | + | let surfAssetId = asBytes(invoke(this, "issueSurf", [surfAmount], nil)) | |
451 | + | let surfAction = if (autoStake) | |
452 | + | then { | |
453 | + | let stakingInv = invoke(surfStakingContract, "stakeByOriginCaller", nil, [AttachedPayment(surfAssetId, surfAmount)]) | |
454 | + | if ((stakingInv == stakingInv)) | |
455 | + | then nil | |
456 | + | else throw("Strict value is not equal to itself.") | |
457 | + | } | |
458 | + | else [ScriptTransfer(i.caller, surfAmount, surfAssetId)] | |
459 | + | ((transfer ++ [surfData(surfResult)]) ++ surfAction) | |
460 | + | } | |
461 | + | } | |
462 | + | } | |
463 | + | } | |
455 | 464 | ||
456 | 465 | ||
457 | 466 | ||
458 | 467 | @Callable(i) | |
459 | 468 | func issueSurf (surfAmount) = { | |
460 | 469 | let surfAssetId = fromBase58String(getStringValue(SurfAssetIdKey)) | |
461 | 470 | if ((i.caller != this)) | |
462 | 471 | then throw("issueSurf - permission denied") | |
463 | 472 | else $Tuple2([Reissue(surfAssetId, surfAmount, true)], surfAssetId) | |
464 | 473 | } | |
465 | 474 | ||
466 | 475 | ||
467 | 476 | ||
468 | 477 | @Callable(i) | |
469 | 478 | func updateReservesAndNeutrinoSupply () = { | |
470 | 479 | func getNumberByKeyInternal (key) = match getInteger(this, key) { | |
471 | 480 | case a: Int => | |
472 | 481 | a | |
473 | 482 | case _ => | |
474 | 483 | 0 | |
475 | 484 | } | |
476 | 485 | ||
477 | 486 | let nMetrix = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
478 | 487 | let idx = getNumberByKeyInternal("updateReservesAndNeutrinoSupplyIdx") | |
479 | 488 | let newIdx = (idx + 1) | |
480 | 489 | [IntegerEntry("updateReservesAndNeutrinoSupplyIdx", newIdx), IntegerEntry("reserve", asInt(nMetrix[3])), IntegerEntry("neutrinoSupply", asInt(nMetrix[5])), IntegerEntry("reservesInUsdn", convertWavesToNeutrino(asInt(nMetrix[3]), asInt(nMetrix[0]))), IntegerEntry("deficit", -(asInt(nMetrix[6])))] | |
481 | 490 | } | |
482 | 491 | ||
483 | 492 | ||
484 | 493 | ||
485 | 494 | @Callable(i) | |
486 | 495 | func wavesBalancesVsPayment () = { | |
487 | 496 | let b = wavesBalance(this) | |
488 | 497 | [IntegerEntry("wavesBalance_available", b.available), IntegerEntry("wavesBalance_regular", b.regular), IntegerEntry("wavesBalance_generating", b.generating), IntegerEntry("wavesBalance_effective", b.effective), IntegerEntry("waves_payment", value(i.payments[0]).amount)] | |
489 | 498 | } | |
490 | 499 | ||
491 | 500 | ||
492 | 501 | @Verifier(tx) | |
493 | 502 | func verify () = { | |
494 | 503 | let pubKeyAdminsListStr = makeString(["ExtEEK19nmKj9mCpnWyvEEJFYATLMcVEMvohhUHkyHNm", "Ev5py5FfBQX9cZpYKnfQrTB49Byf8QmpZWeDVRim4yV7", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR"], SEP) | |
495 | 504 | let pubKeyAdminsList = split(valueOrElse(getString(controlContract, "%s__multisig"), pubKeyAdminsListStr), SEP) | |
496 | 505 | let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0]))) | |
497 | 506 | then 1 | |
498 | 507 | else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1]))) | |
499 | 508 | then 1 | |
500 | 509 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2]))) | |
501 | 510 | then 1 | |
502 | 511 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3]))) | |
503 | 512 | then 2 | |
504 | 513 | else 0)) | |
505 | 514 | (count >= 3) | |
506 | 515 | } | |
507 | 516 |
github/deemru/w8io/026f985 61.43 ms ◑