tx · 6B8yquQo5zKWp4TxiBXMmMUNszj1kwqXtNnd5NxF5xxf

3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8:  -0.00400000 Waves

2023.01.20 00:18 [2412333] smart account 3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8 > SELF 0.00000000 Waves

{ "type": 13, "id": "6B8yquQo5zKWp4TxiBXMmMUNszj1kwqXtNnd5NxF5xxf", "fee": 400000, "feeAssetId": null, "timestamp": 1674163135293, "version": 2, "chainId": 84, "sender": "3N1XAEyg1TQGa5FCEerrRhLGi5KyVq26Xm8", "senderPublicKey": "ATuPi6fn8277fNiCoRgPTav9QG15CJoW95GEGcDmfYt8", "proofs": [ "NoyVZneeNfEUcShnuvZZThyGb6zCQrR7APQ6cfgF9xnWUFkYPLqkcLmzWq83gcEAFHZYeR5ViSKoArhkwFbzW1t" ], "script": "base64:BgINCAISABIAEgMKAQgSABgABXdjZElkAiw1V0U2SEJWc21BYmFwVG1US3BteVdtVVI2N2ZjMTZ5YkZyTmp4em1EQnRQYQALd2NkRGVjaW1hbHMAAgETdG90YWxTaGFyZUJ5VXNlcktFWQEFb3duZXIJALkJAgkAzAgCAgZzaGFyZXMJAMwIAgUFb3duZXIFA25pbAIBXwEUdG90YWxTaGFyZUJ5VXNlclJFQUQBBW93bmVyCQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMJARN0b3RhbFNoYXJlQnlVc2VyS0VZAQUFb3duZXIAAAASdG90YWxJc3N1ZWRXQ0RfS0VZAhB0b3RhbF9pc3N1ZWRfV0NEARN0b3RhbElzc3VlZFdDRF9SRUFEAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBRJ0b3RhbElzc3VlZFdDRF9LRVkAAAAOdG90YWxTaGFyZXNLRVkCDHRvdGFsX3NoYXJlcwEPdG90YWxTaGFyZXNSRUFEAAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQ50b3RhbFNoYXJlc0tFWQAAABJ0b3RhbEN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dGVyYWxSRUFEAAQMdG90YWxfaXNzdWVkCQETdG90YWxJc3N1ZWRXQ0RfUkVBRAAJAMwIAgkBDEludGVnZXJFbnRyeQIFEnRvdGFsQ29sbGF0ZXJhbEtFWQkAZAIFD3RvdGFsQ29sbGF0ZXJhbAgFA3BtdAZhbW91bnQJAMwIAgkBDEludGVnZXJFbnRyeQIFEnRvdGFsSXNzdWVkV0NEX0tFWQkAZAIFDHRvdGFsX2lzc3VlZAUQd2NkX2lzc3VlX2Ftb3VudAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQERQGV4dHJOYXRpdmUoMTA2MikBBQdhY2NvdW50BRB3Y2RfaXNzdWVfYW1vdW50CQDZBAEFBXdjZElkBQNuaWwBaQEEdGVzdAEHYWNjb3VudAkAAgEJAKwCAgIIUmVzdWx0OiAJAKQDAQkBD2dldFVzZXJUTURVX1dDRAEFB2FjY291bnQBaQEHdGVzdF9paQAJAAIBCQCsAgICCFJlc3VsdDogCQCkAwEJAQdnZXRUTURVAACvM82N", "height": 2412333, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7fu5kEaMSS29FR5mmZzKkLZGoex4MUgh7ZguvrPv2Nof Next: mvBeaTcVMZgX6bMcNUspWUWGPuG2YgeKrdGoGYsLbGe Diff:
OldNewDifferences
7070 let max_theorical_unlockable_waves = TMDIRmultiply((diff * 10), totalIssuedWCD_READ(), paramA_READ())
7171 if ((diff > max_theorical_unlockable_waves))
7272 then max_theorical_unlockable_waves
73- else diff
73+ else max_theorical_unlockable_waves
7474 }
7575 else 0
7676 }
7979 func getUserTMDI_WAVES (owner) = (1000000 * fraction(getTMDI(), userShareFraction(owner), wavesReferencePrice_READ()))
8080
8181
82-func getUserTMDU_WCD (owner) = fraction(fraction(getTMDU(), userShareFraction(owner), 100000000), wavesReferencePrice_READ(), 100000000000000)
82+func getUserTMDU (owner) = fraction(getTMDU(), userShareFraction(owner), 100000000)
83+
84+
85+func getUserTMDU_WCD (owner) = fraction(fraction(getTMDU(), userShareFraction(owner), 100000000), wavesReferencePrice_READ(), 100000000)
8386
8487
8588 @Callable(i)
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 totalCollateralKEY = "total_collateral"
2525
2626 func totalCollateralREAD () = valueOrElse(getInteger(this, totalCollateralKEY), 0)
2727
2828
2929 let INITIAL_PRICE = 240000000
3030
3131 let wavesReferencePrice_KEY = "waves_reference_price"
3232
3333 func wavesReferencePrice_READ () = valueOrElse(getInteger(this, wavesReferencePrice_KEY), INITIAL_PRICE)
3434
3535
3636 func userShareFraction (owner) = {
3737 let totalShares = totalSharesREAD()
3838 if ((totalShares > 0))
3939 then {
4040 let totalUserShare = totalShareByUserREAD(owner)
4141 fraction(100000000, totalUserShare, totalShares)
4242 }
4343 else 0
4444 }
4545
4646
4747 let paramA_KEY = "A"
4848
4949 func paramA_READ () = valueOrElse(getInteger(this, "A"), 100)
5050
5151
5252 func computeLogTMDIR (issued_wcd,A) = (500000000 - (log(issued_wcd, wcdDecimals, 10, 0, 6, HALFUP) * A))
5353
5454
5555 func TMDIRmultiply (amount,issued_wcd,A) = fraction(amount, pow(10, 0, computeLogTMDIR(issued_wcd, A), 8, 8, HALFUP), 100000000)
5656
5757
5858 func computeTMDI (issued_wcd,A) = if ((issued_wcd > 10000000))
5959 then TMDIRmultiply(issued_wcd, issued_wcd, A)
6060 else 10000000
6161
6262
6363 func getTMDI () = computeTMDI(totalIssuedWCD_READ(), paramA_READ())
6464
6565
6666 func getTMDU () = {
6767 let diff = (totalCollateralREAD() - totalSharesREAD())
6868 if ((diff > 0))
6969 then {
7070 let max_theorical_unlockable_waves = TMDIRmultiply((diff * 10), totalIssuedWCD_READ(), paramA_READ())
7171 if ((diff > max_theorical_unlockable_waves))
7272 then max_theorical_unlockable_waves
73- else diff
73+ else max_theorical_unlockable_waves
7474 }
7575 else 0
7676 }
7777
7878
7979 func getUserTMDI_WAVES (owner) = (1000000 * fraction(getTMDI(), userShareFraction(owner), wavesReferencePrice_READ()))
8080
8181
82-func getUserTMDU_WCD (owner) = fraction(fraction(getTMDU(), userShareFraction(owner), 100000000), wavesReferencePrice_READ(), 100000000000000)
82+func getUserTMDU (owner) = fraction(getTMDU(), userShareFraction(owner), 100000000)
83+
84+
85+func getUserTMDU_WCD (owner) = fraction(fraction(getTMDU(), userShareFraction(owner), 100000000), wavesReferencePrice_READ(), 100000000)
8386
8487
8588 @Callable(i)
8689 func deposit_share () = {
8790 let pmt = if ((size(i.payments) == 1))
8891 then i.payments[0]
8992 else throw("Attached payment is required")
9093 if (isDefined(pmt.assetId))
9194 then throw("Only WAVES is allowed.")
9295 else {
9396 let account = toString(i.caller)
9497 let totalShareByUser = totalShareByUserREAD(account)
9598 let totalShares = totalSharesREAD()
9699 let totalCollateral = totalCollateralREAD()
97100 [IntegerEntry(totalShareByUserKEY(account), (totalShareByUser + pmt.amount)), IntegerEntry(totalSharesKEY, (totalShares + pmt.amount)), IntegerEntry(totalCollateralKEY, (totalCollateral + pmt.amount))]
98101 }
99102 }
100103
101104
102105
103106 @Callable(i)
104107 func issue () = {
105108 let pmt = if ((size(i.payments) == 1))
106109 then i.payments[0]
107110 else throw("Attached payment is required")
108111 if (isDefined(pmt.assetId))
109112 then throw("Only WAVES is allowed.")
110113 else {
111114 let account = toString(i.caller)
112115 let max_waves = getUserTMDI_WAVES(account)
113116 if ((pmt.amount > max_waves))
114117 then throw((((("User lock limit is " + toString(max_waves)) + " WAVES. Sent ") + toString(pmt.amount)) + " WAVES."))
115118 else {
116119 let wcd_issue_amount = fraction(pmt.amount, wavesReferencePrice_READ(), 100000000000000)
117120 let totalCollateral = totalCollateralREAD()
118121 let total_issued = totalIssuedWCD_READ()
119122 [IntegerEntry(totalCollateralKEY, (totalCollateral + pmt.amount)), IntegerEntry(totalIssuedWCD_KEY, (total_issued + wcd_issue_amount)), ScriptTransfer(addressFromStringValue(account), wcd_issue_amount, fromBase58String(wcdId))]
120123 }
121124 }
122125 }
123126
124127
125128
126129 @Callable(i)
127130 func test (account) = throw(("Result: " + toString(getUserTMDU_WCD(account))))
128131
129132
130133
131134 @Callable(i)
132135 func test_ii () = throw(("Result: " + toString(getTMDU())))
133136
134137

github/deemru/w8io/169f3d6 
29.71 ms