tx · 5rWF8nn87njr19w2C8RQx62hPHAvCdELSTT2J34yPz9T

3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8:  -0.00200000 Waves

2023.01.16 15:58 [2407534] smart account 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8 > SELF 0.00000000 Waves

{ "type": 13, "id": "5rWF8nn87njr19w2C8RQx62hPHAvCdELSTT2J34yPz9T", "fee": 200000, "feeAssetId": null, "timestamp": 1673873940555, "version": 2, "chainId": 84, "sender": "3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8", "senderPublicKey": "ATuPi6fn8277fNiCoRgPTav9QG15CJoW95GEGcDmfYt8", "proofs": [ "4bvzsAAd9vepfFbX8m7u8VSr9i8XkJidwqLQqkX6m6tqqaBqryAPuDmagdDKmudYRkDs2AEDz2p1sD4vfPKgKEFG" ], "script": "base64:BgIMCAISABIAEgQKAgEBDQAFd2NkSWQCLDVXRTZIQlZzbUFiYXBUbVRLcG15V21VUjY3ZmMxNnliRnJOanh6bURCdFBhAAt3Y2REZWNpbWFscwACARN0b3RhbFNoYXJlQnlVc2VyS0VZAQVvd25lcgkAuQkCCQDMCAICBnNoYXJlcwkAzAgCBQVvd25lcgUDbmlsAgFfARR0b3RhbFNoYXJlQnlVc2VyUkVBRAEFb3duZXIJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwkBE3RvdGFsU2hhcmVCeVVzZXJLRVkBBQVvd25lcgAAABJ0b3RhbElzc3VlZFdDRF9LRVkCEHRvdGFsX2lzc3VlZF9XQ0QBE3RvdGFsSXNzdWVkV0NEX1JFQUQACQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFEnRvdGFsSXNzdWVkV0NEX0tFWQAAAA50b3RhbFNoYXJlc0tFWQIMdG90YWxfc2hhcmVzAQ90b3RhbFNoYXJlc1JFQUQACQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFDnRvdGFsU2hhcmVzS0VZAAAACnBhcmFtQV9LRVkC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mVzdWx0OiAJAKQDAQkBB2dldFRNREkAAWkBFGdldF90bWRpX2Zyb21fcGFyYW1zAgppc3N1ZWRfd2NkAUEJAAIBCQCsAgICCHJlc3VsdDogCQCkAwEJAQtjb21wdXRlVE1ESQIFCmlzc3VlZF93Y2QFAUEAlO4Reg==", "height": 2407534, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9dUTsnp7UvCNFL2nsPgBCKiMJXFCtqUtvmm7y1oZboen Next: 3tuUFgW6Wt4H3Fd1sRc16LtkpQqYfwXeeen2hqmo3St7 Diff:
OldNewDifferences
2626 func paramA_READ () = valueOrElse(getInteger(this, "A"), 100)
2727
2828
29-func computeLogTMDIR (issued_wcd,A) = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A))
29+func computeTMDIR (issued_wcd,A) = {
30+ let logTMDIR = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A))
31+ fraction(1, pow(10, 0, logTMDIR, 8, 8, HALFUP), 100000000)
32+ }
3033
3134
3235 func computeTMDI (issued_wcd,A) = if ((issued_wcd > 10000000))
33- then fraction(issued_wcd, pow(10, 0, computeLogTMDIR(issued_wcd, A), 8, 8, HALFUP), 100000000)
36+ then (issued_wcd * computeTMDIR(issued_wcd, A))
3437 else 10000000
3538
3639
5861 func get_tmdi () = throw(("result: " + toString(getTMDI())))
5962
6063
64+
65+@Callable(i)
66+func get_tmdi_from_params (issued_wcd,A) = throw(("result: " + toString(computeTMDI(issued_wcd, A))))
67+
68+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let wcdId = "5WE6HBVsmAbapTmTKpmyWmUR67fc16ybFrNjxzmDBtPa"
55
66 let wcdDecimals = 2
77
88 func totalShareByUserKEY (owner) = makeString(["shares", owner], "_")
99
1010
1111 func totalShareByUserREAD (owner) = valueOrElse(getInteger(this, totalShareByUserKEY(owner)), 0)
1212
1313
1414 let totalIssuedWCD_KEY = "total_issued_WCD"
1515
1616 func totalIssuedWCD_READ () = valueOrElse(getInteger(this, totalIssuedWCD_KEY), 0)
1717
1818
1919 let totalSharesKEY = "total_shares"
2020
2121 func totalSharesREAD () = valueOrElse(getInteger(this, totalSharesKEY), 0)
2222
2323
2424 let paramA_KEY = "A"
2525
2626 func paramA_READ () = valueOrElse(getInteger(this, "A"), 100)
2727
2828
29-func computeLogTMDIR (issued_wcd,A) = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A))
29+func computeTMDIR (issued_wcd,A) = {
30+ let logTMDIR = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A))
31+ fraction(1, pow(10, 0, logTMDIR, 8, 8, HALFUP), 100000000)
32+ }
3033
3134
3235 func computeTMDI (issued_wcd,A) = if ((issued_wcd > 10000000))
33- then fraction(issued_wcd, pow(10, 0, computeLogTMDIR(issued_wcd, A), 8, 8, HALFUP), 100000000)
36+ then (issued_wcd * computeTMDIR(issued_wcd, A))
3437 else 10000000
3538
3639
3740 func getTMDI () = computeTMDI(totalIssuedWCD_READ(), paramA_READ())
3841
3942
4043 @Callable(i)
4144 func deposit_share () = {
4245 let pmt = if ((size(i.payments) == 1))
4346 then i.payments[0]
4447 else throw("Attached payment is required")
4548 if (isDefined(pmt.assetId))
4649 then throw("Only WAVES is allowed.")
4750 else {
4851 let account = toString(i.caller)
4952 let totalShareByUser = totalShareByUserREAD(account)
5053 let totalShares = totalSharesREAD()
5154 [IntegerEntry(totalShareByUserKEY(account), (totalShareByUser + pmt.amount)), IntegerEntry(totalSharesKEY, (totalShares + pmt.amount))]
5255 }
5356 }
5457
5558
5659
5760 @Callable(i)
5861 func get_tmdi () = throw(("result: " + toString(getTMDI())))
5962
6063
64+
65+@Callable(i)
66+func get_tmdi_from_params (issued_wcd,A) = throw(("result: " + toString(computeTMDI(issued_wcd, A))))
67+
68+

github/deemru/w8io/169f3d6 
44.75 ms