tx · CBmDcHwC5JVLoBBNLckWtCndHtzxai1kgvSmSSCdzK1y 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8: -0.00200000 Waves 2023.01.16 14:50 [2407462] smart account 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8 > SELF 0.00000000 Waves
{ "type": 13, "id": "CBmDcHwC5JVLoBBNLckWtCndHtzxai1kgvSmSSCdzK1y", "fee": 200000, "feeAssetId": null, "timestamp": 1673869872176, "version": 2, "chainId": 84, "sender": "3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8", "senderPublicKey": "ATuPi6fn8277fNiCoRgPTav9QG15CJoW95GEGcDmfYt8", "proofs": [ "626TAXrjpNxSaVxFrks35tYo85Pdns9bwkD5Xhif6bCLWeDrm1vfh2fgp4gk2PpbNiQnbXZVzYcVE1F9WYGTAv52" ], "script": "base64:BgIKCAISABIECgIBAQ4ABXdjZElkAiw1V0U2SEJWc21BYmFwVG1US3BteVdtVVI2N2ZjMTZ5YkZyTmp4em1EQnRQYQALd2NkRGVjaW1hbHMAAgETdG90YWxTaGFyZUJ5VXNlcktFWQEFb3duZXIJALkJAgkAzAgCAgZzaGFyZXMJAMwIAgUFb3duZXIFA25pbAIBXwEUdG90YWxTaGFyZUJ5VXNlclJFQUQBBW93bmVyCQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMJARN0b3RhbFNoYXJlQnlVc2VyS0VZAQUFb3duZXIAAAASdG90YWxJc3N1ZWRXQ0RfS0VZAhB0b3RhbF9pc3N1ZWRfV0NEARN0b3RhbElzc3VlZFdDRF9SRUFEAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBRJ0b3RhbElzc3VlZFdDRF9LRVkAAAAOdG90YWxTaGFyZXNLRVkCDHRvdGFsX3NoYXJlcwEPdG90YWxTaGFyZXNSRUFEAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQ50b3RhbFNoYXJlc0tFWQAAAApwYXJhbUFfS0VZ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V0ZUxvZ1RNRElSAgUKaXNzdWVkX3djZAUBQQCwnk2C", "height": 2407462, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CVZPBb6TxELh39jnhoH1pymbWBonwW5rfgPzSsav6nvr Next: ExcZDH3fARa154ccM56iBsELHg5eBT1JEqE6ubwugY4F Diff:
Old | New | Differences | |
---|---|---|---|
26 | 26 | func paramA_READ () = valueOrElse(getInteger(this, "A"), 100) | |
27 | 27 | ||
28 | 28 | ||
29 | - | func computeLogTMDIR (issued_wcd,A) = (50000000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A)) | |
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)) | |
30 | 34 | ||
31 | 35 | ||
32 | 36 | func computeTMDI (issued_wcd,A) = if ((issued_wcd > 10000000)) | |
52 | 56 | ||
53 | 57 | ||
54 | 58 | @Callable(i) | |
55 | - | func get_tmdi (issued_wcd,A) = throw(("result: " + toString( | |
59 | + | func get_tmdi (issued_wcd,A) = throw(("result: " + toString(computeLogTMDIR(issued_wcd, A)))) | |
56 | 60 | ||
57 | 61 |
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 | - | func computeLogTMDIR (issued_wcd,A) = (50000000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A)) | |
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)) | |
30 | 34 | ||
31 | 35 | ||
32 | 36 | func computeTMDI (issued_wcd,A) = if ((issued_wcd > 10000000)) | |
33 | 37 | then (issued_wcd * pow(10, 0, computeLogTMDIR(issued_wcd, A), 8, 0, HALFUP)) | |
34 | 38 | else 10000000 | |
35 | 39 | ||
36 | 40 | ||
37 | 41 | @Callable(i) | |
38 | 42 | func deposit_share () = { | |
39 | 43 | let pmt = if ((size(i.payments) == 1)) | |
40 | 44 | then i.payments[0] | |
41 | 45 | else throw("Attached payment is required") | |
42 | 46 | if (isDefined(pmt.assetId)) | |
43 | 47 | then throw("Only WAVES is allowed.") | |
44 | 48 | else { | |
45 | 49 | let account = toString(i.caller) | |
46 | 50 | let totalShareByUser = totalShareByUserREAD(account) | |
47 | 51 | let totalShares = totalSharesREAD() | |
48 | 52 | [IntegerEntry(totalShareByUserKEY(account), (totalShareByUser + pmt.amount)), IntegerEntry(totalSharesKEY, (totalShares + pmt.amount))] | |
49 | 53 | } | |
50 | 54 | } | |
51 | 55 | ||
52 | 56 | ||
53 | 57 | ||
54 | 58 | @Callable(i) | |
55 | - | func get_tmdi (issued_wcd,A) = throw(("result: " + toString( | |
59 | + | func get_tmdi (issued_wcd,A) = throw(("result: " + toString(computeLogTMDIR(issued_wcd, A)))) | |
56 | 60 | ||
57 | 61 |
github/deemru/w8io/169f3d6 30.41 ms ◑