tx · 2j97dXTmq9mHQYPhL7Rj14PsrMZq5KMmQ48PS2Yvq6bj

3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH:  -0.04000000 Waves

2022.04.11 12:20 [2003741] smart account 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH > SELF 0.00000000 Waves

{ "type": 13, "id": "2j97dXTmq9mHQYPhL7Rj14PsrMZq5KMmQ48PS2Yvq6bj", "fee": 4000000, "feeAssetId": null, "timestamp": 1649668919276, "version": 2, "chainId": 84, "sender": "3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH", "senderPublicKey": "HJ4JLtArYaaiBiWho6gzLRbKUVM6ZVTaKmci6sgFQtEm", "proofs": [ "3uu9CNwuyAcjviSx5V2CAAnhP6tsLTm8y8X22X3f9wRsHyecsVjZiudTPSCbr9ThcdYMWgmZYqgfcP2XE4GF7ZvS" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAADAAAAAAJJRAEAAAAg/xBHdpoc7iAAQfoZXdECvjjJUsHBvTbctJWSuRHjmWIAAAAAAkxQAQAAACBUgJin8ZP4V+99JlgBkqGEJd4kKpy7bL9Mn0vxHVzLPwAAAAAJaXNTdG9wcGVkBwAAAAIAAAABaQEAAAAFc3Rha2UAAAAABAAAAANwbXQJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACXBtdEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAAAklECQAAAgAAAAECAAAAG2F0dGFjaCB0ZXN0TlNCVCB0b2tlbnMgb25seQMFAAAACWlzU3RvcHBlZAkAAAIAAAABAgAAABlzbWFydCBjb250cmFjdCBpcyBvbiBsb2NrBAAAAAppblRyZWFzdXJ5CQAD8AAAAAIFAAAABHRoaXMFAAAAAklEBAAAAAt0b3RhbElzc3VlZAQAAAAHJ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AARCdXJuAAAAAgUAAAACTFAFAAAABmFtb3VudAQAAAAIdHJhbnNmZXIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAJbmV3QW1vdW50BQAAAAJJRAkABEwAAAACBQAAAAdidXJuaW5nCQAETAAAAAIFAAAACHRyYW5zZmVyBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleaaoJ4s=", "height": 2003741, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EzGRC4B9JcQtstMe63xffw8yLHL6wbEyteZQ5jN5Nre Next: hTjXb2VVbNrnHwBKsu6HM7LMqxsYgdn7ErEmtR69a2M Diff:
OldNewDifferences
2323 case _ =>
2424 throw("Can't find asset")
2525 }
26- let singleLPinValue = fraction(inTreasury, 1, totalIssued)
27- let amountToIssue = fraction(pmtAmount, singleLPinValue, 1)
28- let LPIssue = Reissue(LP, amountToIssue, true)
29- let transfer = ScriptTransfer(i.caller, amountToIssue, LP)
26+ let singleLPinValue = (totalIssued / inTreasury)
27+ let LPIssue = Reissue(LP, singleLPinValue, true)
28+ let transfer = ScriptTransfer(i.caller, singleLPinValue, LP)
3029 [LPIssue, transfer]
3130 }
3231 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ID = base58'JAfMu2seKNzTVfqi5w5Pjh4kwwPTZPCEFpc2q2vDyFeh'
55
66 let LP = base58'6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU'
77
88 let isStopped = false
99
1010 @Callable(i)
1111 func stake () = {
1212 let pmt = value(i.payments[0])
1313 let pmtAmount = pmt.amount
1414 if ((pmt.assetId != ID))
1515 then throw("attach testNSBT tokens only")
1616 else if (isStopped)
1717 then throw("smart contract is on lock")
1818 else {
1919 let inTreasury = assetBalance(this, ID)
2020 let totalIssued = match assetInfo(LP) {
2121 case asset: Asset =>
2222 asset.quantity
2323 case _ =>
2424 throw("Can't find asset")
2525 }
26- let singleLPinValue = fraction(inTreasury, 1, totalIssued)
27- let amountToIssue = fraction(pmtAmount, singleLPinValue, 1)
28- let LPIssue = Reissue(LP, amountToIssue, true)
29- let transfer = ScriptTransfer(i.caller, amountToIssue, LP)
26+ let singleLPinValue = (totalIssued / inTreasury)
27+ let LPIssue = Reissue(LP, singleLPinValue, true)
28+ let transfer = ScriptTransfer(i.caller, singleLPinValue, LP)
3029 [LPIssue, transfer]
3130 }
3231 }
3332
3433
3534
3635 @Callable(i)
3736 func withdraw (amount) = {
3837 let attached = i.payments[0]
3938 let paymentID = i.payments[0].assetId
4039 if ((paymentID != LP))
4140 then throw("Attach the correct LP token")
4241 else {
4342 let newAmount = (attached.amount - amount)
4443 if ((0 > amount))
4544 then throw("Can't withdraw negative amount")
4645 else if ((0 > newAmount))
4746 then throw("Not enough balance")
4847 else {
4948 let burning = Burn(LP, amount)
5049 let transfer = ScriptTransfer(i.caller, newAmount, ID)
5150 [burning, transfer]
5251 }
5352 }
5453 }
5554
5655
5756 @Verifier(tx)
5857 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5958

github/deemru/w8io/169f3d6 
40.33 ms