tx · 9sp67RQCteudwaeVoYzRjuJteuCopmukCpojTHUg2yXb 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8: -0.00200000 Waves 2023.01.16 16:12 [2407547] smart account 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8 > SELF 0.00000000 Waves
{ "type": 13, "id": "9sp67RQCteudwaeVoYzRjuJteuCopmukCpojTHUg2yXb", "fee": 200000, "feeAssetId": null, "timestamp": 1673874853613, "version": 2, "chainId": 84, "sender": "3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8", "senderPublicKey": "ATuPi6fn8277fNiCoRgPTav9QG15CJoW95GEGcDmfYt8", "proofs": [ "4UCcUq5qMReo5YZMXKb3R4TxzRvhe3hNjhMU5ntfZ3oLVg2kY9b8PeDhGGHTcHXUzmJmbeQhgGzsWD9JqFt9iy9H" ], "script": "base64:BgIKCAISABIECgIBAQ4ABXdjZElkAiw1V0U2SEJWc21BYmFwVG1US3BteVdtVVI2N2ZjMTZ5YkZyTmp4em1EQnRQYQALd2NkRGVjaW1hbHMAAgETdG90YWxTaGFyZUJ5VXNlcktFWQEFb3duZXIJALkJAgkAzAgCAgZzaGFyZXMJAMwIAgUFb3duZXIFA25pbAIBXwEUdG90YWxTaGFyZUJ5VXNlclJFQUQBBW93bmVyCQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMJARN0b3RhbFNoYXJlQnlVc2VyS0VZAQUFb3duZXIAAAASdG90YWxJc3N1ZWRXQ0RfS0VZAhB0b3RhbF9pc3N1ZWRfV0NEARN0b3RhbElzc3VlZFdDRF9SRUFEAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBRJ0b3RhbElzc3VlZFdDRF9LRVkAAAAOdG90YWxTaGFyZXNLRVkCDHRvdGFsX3NoYXJlcwEPdG90YWxTaGFyZXNSRUFEAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQ50b3RhbFNoYXJlc0tFWQAAAApwYXJhbUFfS0VZA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wIAgkBDEludGVnZXJFbnRyeQIFDnRvdGFsU2hhcmVzS0VZCQBkAgULdG90YWxTaGFyZXMIBQNwbXQGYW1vdW50BQNuaWwBaQEIZ2V0X3RtZGkCCmlzc3VlZF93Y2QBQQkAAgEJAKwCAgIIcmVzdWx0OiAJAKQDAQkBC2NvbXB1dGVUTURJAgUKaXNzdWVkX3djZAUBQQDM51vx", "height": 2407547, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2pECQZaYJ27XkPhx2pPiSyaxhqqSDCMSw9NnbgQfT4ey Next: 26B55LK7guRV5gm2apmEAnEmnnihYWJUa88HNGsq9PoS Diff:
Old | New | Differences | |
---|---|---|---|
29 | 29 | func computeLogTMDIR (issued_wcd,A) = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A)) | |
30 | 30 | ||
31 | 31 | ||
32 | + | func computeTMDIR (issued_wcd,A) = { | |
33 | + | let logTMDIR = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A)) | |
34 | + | fraction(1, pow(10, 0, logTMDIR, 8, 8, HALFUP), 100000000) | |
35 | + | } | |
36 | + | ||
37 | + | ||
32 | 38 | func computeTMDI (issued_wcd,A) = if ((issued_wcd > 10000000)) | |
33 | - | then | |
39 | + | then (issued_wcd * computeTMDIR(issued_wcd, A)) | |
34 | 40 | else 10000000 | |
35 | 41 | ||
36 | 42 |
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 | 29 | func computeLogTMDIR (issued_wcd,A) = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A)) | |
30 | 30 | ||
31 | 31 | ||
32 | + | func computeTMDIR (issued_wcd,A) = { | |
33 | + | let logTMDIR = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A)) | |
34 | + | fraction(1, pow(10, 0, logTMDIR, 8, 8, HALFUP), 100000000) | |
35 | + | } | |
36 | + | ||
37 | + | ||
32 | 38 | func computeTMDI (issued_wcd,A) = if ((issued_wcd > 10000000)) | |
33 | - | then | |
39 | + | then (issued_wcd * computeTMDIR(issued_wcd, A)) | |
34 | 40 | else 10000000 | |
35 | 41 | ||
36 | 42 | ||
37 | 43 | func getTMDI () = computeTMDI(totalIssuedWCD_READ(), paramA_READ()) | |
38 | 44 | ||
39 | 45 | ||
40 | 46 | @Callable(i) | |
41 | 47 | func deposit_share () = { | |
42 | 48 | let pmt = if ((size(i.payments) == 1)) | |
43 | 49 | then i.payments[0] | |
44 | 50 | else throw("Attached payment is required") | |
45 | 51 | if (isDefined(pmt.assetId)) | |
46 | 52 | then throw("Only WAVES is allowed.") | |
47 | 53 | else { | |
48 | 54 | let account = toString(i.caller) | |
49 | 55 | let totalShareByUser = totalShareByUserREAD(account) | |
50 | 56 | let totalShares = totalSharesREAD() | |
51 | 57 | [IntegerEntry(totalShareByUserKEY(account), (totalShareByUser + pmt.amount)), IntegerEntry(totalSharesKEY, (totalShares + pmt.amount))] | |
52 | 58 | } | |
53 | 59 | } | |
54 | 60 | ||
55 | 61 | ||
56 | 62 | ||
57 | 63 | @Callable(i) | |
58 | 64 | func get_tmdi (issued_wcd,A) = throw(("result: " + toString(computeTMDI(issued_wcd, A)))) | |
59 | 65 | ||
60 | 66 |
github/deemru/w8io/169f3d6 44.06 ms ◑