tx · GdmE14s3JsyKMJMyUrkmjz9zZmHEsT8PFAZNK4beRrWU

3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH:  -0.04000000 Waves

2022.04.11 13:23 [2003804] smart account 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH > SELF 0.00000000 Waves

{ "type": 13, "id": "GdmE14s3JsyKMJMyUrkmjz9zZmHEsT8PFAZNK4beRrWU", "fee": 4000000, "feeAssetId": null, "timestamp": 1649672672746, "version": 2, "chainId": 84, "sender": "3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH", "senderPublicKey": "HJ4JLtArYaaiBiWho6gzLRbKUVM6ZVTaKmci6sgFQtEm", "proofs": [ "2E4X4vVXfNLrp23EVPSLfPM5cbWFFbUGNCCHZQ9Mz67BjMFfaffBQmFrzDyZpoEH5fLfw6y7H85NSLkM2y6DiDxL" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAADAAAAAAJJRAEAAAAg/xBHdpoc7iAAQfoZXdECvjjJUsHBvTbctJWSuRHjmWIAAAAAAkxQAQAAACBUgJin8ZP4V+99JlgBkqGEJd4kKpy7bL9Mn0vxHVzLPwAAAAAJaXNTdG9wcGVkBwAAAAIAAAABaQEAAAAFc3Rha2UAAAAABAAAAANwbXQJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACXBtdEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAAAklECQAAAgAAAAECAAAAG2F0dGFjaCB0ZXN0TlNCVCB0b2tlbnMgb25seQMFAAAACWlzU3RvcHBlZAkAAAIAAAABAgAAABlzbWFydCBjb250cmFjdCBpcyBvbiBsb2NrBAAAAAppblRyZWFzdXJ5CQAD8AAAAAIFAAAABHRoaXMFAAAAAklEBAAAAAt0b3RhbElzc3VlZAQAAAAHJG1hd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JAAACAAAAAQIAAAASTm90IGVub3VnaCBiYWxhbmNlBAAAAAdidXJuaW5nCQEAAAAEQnVybgAAAAIFAAAAAkxQBQAAAAZhbW91bnQEAAAACHRyYW5zZmVyCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAACW5ld0Ftb3VudAUAAAACSUQJAARMAAAAAgUAAAAHYnVybmluZwkABEwAAAACBQAAAAh0cmFuc2ZlcgUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXnp56kM", "height": 2003804, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Do5tjP2ciyXujzJR1wyq823LGAVXFeecniMbpaAw9nYY Next: J4heHPYFVFCehVNKCDUkm7QB9RQj7E9N5qMtVUX4ndsj Diff:
OldNewDifferences
2323 case _ =>
2424 throw("Can't find asset")
2525 }
26- let singleLPinValue = ((inTreasury / totalIssued) * 10000)
26+ let singleLPinValue = (inTreasury / totalIssued)
27+ let amountToIssue = (pmtAmount * singleLPinValue)
2728 let LPIssue = Reissue(LP, singleLPinValue, true)
28- let transfer = ScriptTransfer(i.caller, singleLPinValue, LP)
29+ let transfer = ScriptTransfer(i.caller, amountToIssue, LP)
2930 [LPIssue, transfer]
3031 }
3132 }
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 = ((inTreasury / totalIssued) * 10000)
26+ let singleLPinValue = (inTreasury / totalIssued)
27+ let amountToIssue = (pmtAmount * singleLPinValue)
2728 let LPIssue = Reissue(LP, singleLPinValue, true)
28- let transfer = ScriptTransfer(i.caller, singleLPinValue, LP)
29+ let transfer = ScriptTransfer(i.caller, amountToIssue, LP)
2930 [LPIssue, transfer]
3031 }
3132 }
3233
3334
3435
3536 @Callable(i)
3637 func withdraw (amount) = {
3738 let attached = i.payments[0]
3839 let paymentID = i.payments[0].assetId
3940 if ((paymentID != LP))
4041 then throw("Attach the correct LP token")
4142 else {
4243 let newAmount = (attached.amount - amount)
4344 if ((0 > amount))
4445 then throw("Can't withdraw negative amount")
4546 else if ((0 > newAmount))
4647 then throw("Not enough balance")
4748 else {
4849 let burning = Burn(LP, amount)
4950 let transfer = ScriptTransfer(i.caller, newAmount, ID)
5051 [burning, transfer]
5152 }
5253 }
5354 }
5455
5556
5657 @Verifier(tx)
5758 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5859

github/deemru/w8io/169f3d6 
41.45 ms