tx · 3nsCDSfKZaLEfHXfzVbKMXj7qtefwvEyfuhr9zYHi2jd 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8: -0.00200000 Waves 2023.01.16 15:01 [2407471] smart account 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8 > SELF 0.00000000 Waves
{ "type": 13, "id": "3nsCDSfKZaLEfHXfzVbKMXj7qtefwvEyfuhr9zYHi2jd", "fee": 200000, "feeAssetId": null, "timestamp": 1673870488507, "version": 2, "chainId": 84, "sender": "3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8", "senderPublicKey": "ATuPi6fn8277fNiCoRgPTav9QG15CJoW95GEGcDmfYt8", "proofs": [ "555wDusnJz4Do8vAgJSZanWgWqJbsvfm56R79igYaQvWqXy3n7bK8jxa3Nu42BrNuNBnoZivPnX2TRTTbs3xa5YY" ], "script": "base64:BgIKCAISABIECgIBAQwABXdjZElkAiw1V0U2SEJWc21BYmFwVG1US3BteVdtVVI2N2ZjMTZ5YkZyTmp4em1EQnRQYQALd2NkRGVjaW1hbHMAAgETdG90YWxTaGFyZUJ5VXNlcktFWQEFb3duZXIJALkJAgkAzAgCAgZzaGFyZXMJAMwIAgUFb3duZXIFA25pbAIBXwEUdG90YWxTaGFyZUJ5VXNlclJFQUQBBW93bmVyCQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMJARN0b3RhbFNoYXJlQnlVc2VyS0VZAQUFb3duZXIAAAASdG90YWxJc3N1ZWRXQ0RfS0VZAhB0b3RhbF9pc3N1ZWRfV0NEARN0b3RhbElzc3VlZFdDRF9SRUFEAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBRJ0b3RhbElzc3VlZFdDRF9LRVkAAAAOdG90YWxTaGFyZXNLRVkCDHRvdGFsX3NoYXJlcwEPdG90YWxTaGFyZXNSRUFEAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQ50b3RhbFNoYXJlc0tFWQAAAApwYXJhbUFfS0V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", "spentComplexity": 0 } View: original | compacted Prev: ExcZDH3fARa154ccM56iBsELHg5eBT1JEqE6ubwugY4F Next: 9qwqxs4zhxmxdekLK4h3KK6DUD2prrVy6QeXVoSkEzqE Diff:
Old | New | Differences | |
---|---|---|---|
26 | 26 | func paramA_READ () = valueOrElse(getInteger(this, "A"), 100) | |
27 | 27 | ||
28 | 28 | ||
29 | - | let ADecimals = 2 | |
30 | - | ||
31 | - | let TMDIRDecimals = 8 | |
32 | - | ||
33 | - | func computeLogTMDIR (issued_wcd,A) = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, (TMDIRDecimals - ADecimals), HALFUP) * A)) | |
29 | + | func computeLogTMDIR (issued_wcd,A) = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A)) | |
34 | 30 | ||
35 | 31 | ||
36 | 32 | func computeTMDI (issued_wcd,A) = if ((issued_wcd > 10000000)) | |
37 | - | then (issued_wcd * pow(10, 0, computeLogTMDIR(issued_wcd, A), 8, | |
33 | + | then (issued_wcd * pow(10, 0, computeLogTMDIR(issued_wcd, A), 8, 2, HALFUP)) | |
38 | 34 | else 10000000 | |
39 | 35 | ||
40 | 36 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let wcdId = "5WE6HBVsmAbapTmTKpmyWmUR67fc16ybFrNjxzmDBtPa" | |
5 | 5 | ||
6 | 6 | let wcdDecimals = 2 | |
7 | 7 | ||
8 | 8 | func totalShareByUserKEY (owner) = makeString(["shares", owner], "_") | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func totalShareByUserREAD (owner) = valueOrElse(getInteger(this, totalShareByUserKEY(owner)), 0) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | let totalIssuedWCD_KEY = "total_issued_WCD" | |
15 | 15 | ||
16 | 16 | func totalIssuedWCD_READ () = valueOrElse(getInteger(this, totalIssuedWCD_KEY), 0) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | let totalSharesKEY = "total_shares" | |
20 | 20 | ||
21 | 21 | func totalSharesREAD () = valueOrElse(getInteger(this, totalSharesKEY), 0) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | let paramA_KEY = "A" | |
25 | 25 | ||
26 | 26 | func paramA_READ () = valueOrElse(getInteger(this, "A"), 100) | |
27 | 27 | ||
28 | 28 | ||
29 | - | let ADecimals = 2 | |
30 | - | ||
31 | - | let TMDIRDecimals = 8 | |
32 | - | ||
33 | - | func computeLogTMDIR (issued_wcd,A) = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, (TMDIRDecimals - ADecimals), HALFUP) * A)) | |
29 | + | func computeLogTMDIR (issued_wcd,A) = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A)) | |
34 | 30 | ||
35 | 31 | ||
36 | 32 | func computeTMDI (issued_wcd,A) = if ((issued_wcd > 10000000)) | |
37 | - | then (issued_wcd * pow(10, 0, computeLogTMDIR(issued_wcd, A), 8, | |
33 | + | then (issued_wcd * pow(10, 0, computeLogTMDIR(issued_wcd, A), 8, 2, HALFUP)) | |
38 | 34 | else 10000000 | |
39 | 35 | ||
40 | 36 | ||
41 | 37 | @Callable(i) | |
42 | 38 | func deposit_share () = { | |
43 | 39 | let pmt = if ((size(i.payments) == 1)) | |
44 | 40 | then i.payments[0] | |
45 | 41 | else throw("Attached payment is required") | |
46 | 42 | if (isDefined(pmt.assetId)) | |
47 | 43 | then throw("Only WAVES is allowed.") | |
48 | 44 | else { | |
49 | 45 | let account = toString(i.caller) | |
50 | 46 | let totalShareByUser = totalShareByUserREAD(account) | |
51 | 47 | let totalShares = totalSharesREAD() | |
52 | 48 | [IntegerEntry(totalShareByUserKEY(account), (totalShareByUser + pmt.amount)), IntegerEntry(totalSharesKEY, (totalShares + pmt.amount))] | |
53 | 49 | } | |
54 | 50 | } | |
55 | 51 | ||
56 | 52 | ||
57 | 53 | ||
58 | 54 | @Callable(i) | |
59 | 55 | func get_tmdi (issued_wcd,A) = throw(("result: " + toString(computeTMDI(issued_wcd, A)))) | |
60 | 56 | ||
61 | 57 |
github/deemru/w8io/169f3d6 38.85 ms ◑