tx · BEWKpjcYDdoy5XrQZNazuT3i9J4YFb5AqebabARtUAvq

3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8:  -0.00200000 Waves

2023.01.15 17:48 [2406205] smart account 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8 > SELF 0.00000000 Waves

{ "type": 13, "id": "BEWKpjcYDdoy5XrQZNazuT3i9J4YFb5AqebabARtUAvq", "fee": 200000, "feeAssetId": null, "timestamp": 1673794197406, "version": 2, "chainId": 84, "sender": "3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8", "senderPublicKey": "ATuPi6fn8277fNiCoRgPTav9QG15CJoW95GEGcDmfYt8", "proofs": [ "45HVaC27bhSuJssTN68G2Sbufjg43dGewS88qfuDgsBWWT2FmswWdNiSmNFyb6byD5yWeYYQmyCWi8Tc4oe6m5Ae" ], "script": "base64:BgIKCAISABIECgIBAQsABXdjZElkAiw1V0U2SEJWc21BYmFwVG1US3BteVdtVVI2N2ZjMTZ5YkZyTmp4em1EQnRQYQALd2NkRGVjaW1hbHMAAgETdG90YWxTaGFyZUJ5VXNlcktFWQEFb3duZXIJALkJAgkAzAgCAgZzaGFyZXMJAMwIAgUFb3duZXIFA25pbAIBXwEUdG90YWxTaGFyZUJ5VXNlclJFQUQBBW93bmVyCQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMJARN0b3RhbFNoYXJlQnlVc2VyS0VZAQUFb3duZXIAAAASdG90YWxJc3N1ZWRXQ0RfS0VZAhB0b3RhbF9pc3N1ZWRfV0NEARN0b3RhbElzc3VlZFdDRF9SRUFEAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBRJ0b3RhbElzc3VlZFdDRF9LRVkAAAAOdG90YWxTaGFyZXNLRVkCDHRvdGFsX3NoYXJlcwEPdG90YWxTaGFyZXNSRUFEAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQ50b3RhbFNoYXJlc0tFWQAAAApwYXJhbUFfS0VZAgFBAQtwYXJhbUFfUkVBRAAJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwIBQQBkAQxjb21wdXRlVE1ESVICCmlzc3VlZF93Y2QBQQkAawMAoI0GAOgHCQBsBgUKaXNzdWVkX3djZAULd2NkRGVjaW1hbHMFAUEAAgAIBQZIQUxGVVACAWkBDWRlcG9zaXRfc2hhcmUABANwbXQDCQAAAgkAkAMBCAUBaQhwYXltZW50cwABCQCRAwIIBQFpCHBheW1lbnRzAAAJAAIBAhxBdHRhY2hlZCBwYXltZW50IGlzIHJlcXVpcmVkAwkBCWlzRGVmaW5lZAEIBQNwbXQHYXNzZXRJZAkAAgECFk9ubHkgV0FWRVMgaXMgYWxsb3dlZC4EB2FjY291bnQJAKUIAQgFAWkGY2FsbGVyBBB0b3RhbFNoYXJlQnlVc2VyCQEUdG90YWxTaGFyZUJ5VXNlclJFQUQBBQdhY2NvdW50BAt0b3RhbFNoYXJlcwkBD3RvdGFsU2hhcmVzUkVBRAAJAMwIAgkBDEludGVnZXJFbnRyeQIJARN0b3RhbFNoYXJlQnlVc2VyS0VZAQUHYWNjb3VudAkAZAIFEHRvdGFsU2hhcmVCeVVzZXIIBQNwbXQGYW1vdW50CQDMCAIJAQxJbnRlZ2VyRW50cnkCBQ50b3RhbFNoYXJlc0tFWQkAZAIFC3RvdGFsU2hhcmVzCAUDcG10BmFtb3VudAUDbmlsAWkBCWdldF90bWRpcgIKaXNzdWVkX3djZAFBCQACAQkApAMBCQEMY29tcHV0ZVRNRElSAgUKaXNzdWVkX3djZAUBQQBYmxw3", "height": 2406205, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6AjVp3zBookgTckkr4aoSFzPA6jAQdaYVZjahmHgtoY4 Next: 9GPhzvvXCPRR1ucPDkbwusV2U5vwMfyezMLQNGHeAaAe Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let wcdId = "5WE6HBVsmAbapTmTKpmyWmUR67fc16ybFrNjxzmDBtPa"
5+
6+let wcdDecimals = 2
57
68 func totalShareByUserKEY (owner) = makeString(["shares", owner], "_")
79
911 func totalShareByUserREAD (owner) = valueOrElse(getInteger(this, totalShareByUserKEY(owner)), 0)
1012
1113
12-let totalIssuedWCDKEY = "total_issued_WCD"
14+let totalIssuedWCD_KEY = "total_issued_WCD"
1315
14-func totalIssuedWCD () = valueOrElse(getInteger(this, totalIssuedWCDKEY), 0)
16+func totalIssuedWCD_READ () = valueOrElse(getInteger(this, totalIssuedWCD_KEY), 0)
1517
1618
1719 let totalSharesKEY = "total_shares"
1820
19-func totalShares () = valueOrElse(getInteger(this, totalSharesKEY), 0)
21+func totalSharesREAD () = valueOrElse(getInteger(this, totalSharesKEY), 0)
22+
23+
24+let paramA_KEY = "A"
25+
26+func paramA_READ () = valueOrElse(getInteger(this, "A"), 100)
27+
28+
29+func computeTMDIR (issued_wcd,A) = fraction(100000, 1000, pow(issued_wcd, wcdDecimals, A, 2, 8, HALFUP))
2030
2131
2232 @Callable(i)
2939 else {
3040 let account = toString(i.caller)
3141 let totalShareByUser = totalShareByUserREAD(account)
32- let totalSharesPrev = totalShares()
33-[IntegerEntry(totalShareByUserKEY(account), (totalShareByUser + pmt.amount)), IntegerEntry(totalSharesKEY, (totalSharesPrev + pmt.amount))]
42+ let totalShares = totalSharesREAD()
43+[IntegerEntry(totalShareByUserKEY(account), (totalShareByUser + pmt.amount)), IntegerEntry(totalSharesKEY, (totalShares + pmt.amount))]
3444 }
3545 }
46+
47+
48+
49+@Callable(i)
50+func get_tmdir (issued_wcd,A) = throw(toString(computeTMDIR(issued_wcd, A)))
3651
3752
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let wcdId = "5WE6HBVsmAbapTmTKpmyWmUR67fc16ybFrNjxzmDBtPa"
5+
6+let wcdDecimals = 2
57
68 func totalShareByUserKEY (owner) = makeString(["shares", owner], "_")
79
810
911 func totalShareByUserREAD (owner) = valueOrElse(getInteger(this, totalShareByUserKEY(owner)), 0)
1012
1113
12-let totalIssuedWCDKEY = "total_issued_WCD"
14+let totalIssuedWCD_KEY = "total_issued_WCD"
1315
14-func totalIssuedWCD () = valueOrElse(getInteger(this, totalIssuedWCDKEY), 0)
16+func totalIssuedWCD_READ () = valueOrElse(getInteger(this, totalIssuedWCD_KEY), 0)
1517
1618
1719 let totalSharesKEY = "total_shares"
1820
19-func totalShares () = valueOrElse(getInteger(this, totalSharesKEY), 0)
21+func totalSharesREAD () = valueOrElse(getInteger(this, totalSharesKEY), 0)
22+
23+
24+let paramA_KEY = "A"
25+
26+func paramA_READ () = valueOrElse(getInteger(this, "A"), 100)
27+
28+
29+func computeTMDIR (issued_wcd,A) = fraction(100000, 1000, pow(issued_wcd, wcdDecimals, A, 2, 8, HALFUP))
2030
2131
2232 @Callable(i)
2333 func deposit_share () = {
2434 let pmt = if ((size(i.payments) == 1))
2535 then i.payments[0]
2636 else throw("Attached payment is required")
2737 if (isDefined(pmt.assetId))
2838 then throw("Only WAVES is allowed.")
2939 else {
3040 let account = toString(i.caller)
3141 let totalShareByUser = totalShareByUserREAD(account)
32- let totalSharesPrev = totalShares()
33-[IntegerEntry(totalShareByUserKEY(account), (totalShareByUser + pmt.amount)), IntegerEntry(totalSharesKEY, (totalSharesPrev + pmt.amount))]
42+ let totalShares = totalSharesREAD()
43+[IntegerEntry(totalShareByUserKEY(account), (totalShareByUser + pmt.amount)), IntegerEntry(totalSharesKEY, (totalShares + pmt.amount))]
3444 }
3545 }
46+
47+
48+
49+@Callable(i)
50+func get_tmdir (issued_wcd,A) = throw(toString(computeTMDIR(issued_wcd, A)))
3651
3752

github/deemru/w8io/026f985 
77.81 ms