tx · 3savGe47d3U7XwXgguvU2yBXuU7uu9ajtiMh5xsuCubC 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH: -0.01400000 Waves 2022.04.08 15:20 [1999586] smart account 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH > SELF 0.00000000 Waves
{ "type": 13, "id": "3savGe47d3U7XwXgguvU2yBXuU7uu9ajtiMh5xsuCubC", "fee": 1400000, "feeAssetId": null, "timestamp": 1649420403917, "version": 2, "chainId": 84, "sender": "3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH", "senderPublicKey": "HJ4JLtArYaaiBiWho6gzLRbKUVM6ZVTaKmci6sgFQtEm", "proofs": [ "ysVb6bEfY6pifLUcdxBn8tfxqiBoKWnApeAX3B8WN8VzoyzLm5ExcVFTiULTFc9eCdVQ4KmTyq3G1E53NfnZaGp" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAADAAAAAAJJRAEAAAAg/xBHdpoc7iAAQfoZXdECvjjJUsHBvTbctJWSuRHjmWIAAAAAAkxQAQAAACBUgJin8ZP4V+99JlgBkqGEJd4kKpy7bL9Mn0vxHVzLPwAAAAAJaXNTdG9wcGVkBwAAAAIAAAABaQEAAAAFc3Rha2UAAAAABAAAAANwbXQJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACXBtdEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAAAklECQAAAgAAAAECAAAAG2F0dGFjaCB0ZXN0TlNCVCB0b2tlbnMgb25seQMFAAAACWlzU3RvcHBlZAkAAAIAAAABAgAAABlzbWFydCBjb250cmFjdCBpcyBvbiBsb2NrBAAAAAppblRyZWFzdXJ5CQAD8AAAAAIFAAAABHRoaXMFAAAAAklEBAAAAAt0b3RhbElzc3VlZAkBAAAADEludGVnZXJFbnRy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xQBQAAAAZhbW91bnQEAAAACHRyYW5zZmVyCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAACW5ld0Ftb3VudAUAAAACSUQJAARMAAAAAgUAAAAHYnVybmluZwkABEwAAAACBQAAAAh0cmFuc2ZlcgUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXn2ezQh", "height": 1999586, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BPgpKkmK5i76Y4ero1as8B1qttZzC7m5gcpE5avTH4rM Next: FkCE3w9EFDeKs93QUvyTxqF59wqxxnKPDL9EXfkaZ9vS Diff:
Old | New | Differences | |
---|---|---|---|
18 | 18 | else { | |
19 | 19 | let inTreasury = assetBalance(this, ID) | |
20 | 20 | let totalIssued = IntegerEntry("6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU", 100) | |
21 | - | let LPIssue = Reissue(LP, pmtAmount, true) | |
21 | + | let singleLPinValue = (totalIssued.value / inTreasury) | |
22 | + | let amountToIssue = (pmtAmount * singleLPinValue) | |
23 | + | let LPIssue = Reissue(LP, amountToIssue, true) | |
22 | 24 | let transfer = ScriptTransfer(i.caller, pmtAmount, LP) | |
23 | 25 | [LPIssue, transfer] | |
24 | 26 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ID = base58'JAfMu2seKNzTVfqi5w5Pjh4kwwPTZPCEFpc2q2vDyFeh' | |
5 | 5 | ||
6 | 6 | let LP = base58'6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU' | |
7 | 7 | ||
8 | 8 | let isStopped = false | |
9 | 9 | ||
10 | 10 | @Callable(i) | |
11 | 11 | func stake () = { | |
12 | 12 | let pmt = value(i.payments[0]) | |
13 | 13 | let pmtAmount = pmt.amount | |
14 | 14 | if ((pmt.assetId != ID)) | |
15 | 15 | then throw("attach testNSBT tokens only") | |
16 | 16 | else if (isStopped) | |
17 | 17 | then throw("smart contract is on lock") | |
18 | 18 | else { | |
19 | 19 | let inTreasury = assetBalance(this, ID) | |
20 | 20 | let totalIssued = IntegerEntry("6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU", 100) | |
21 | - | let LPIssue = Reissue(LP, pmtAmount, true) | |
21 | + | let singleLPinValue = (totalIssued.value / inTreasury) | |
22 | + | let amountToIssue = (pmtAmount * singleLPinValue) | |
23 | + | let LPIssue = Reissue(LP, amountToIssue, true) | |
22 | 24 | let transfer = ScriptTransfer(i.caller, pmtAmount, LP) | |
23 | 25 | [LPIssue, transfer] | |
24 | 26 | } | |
25 | 27 | } | |
26 | 28 | ||
27 | 29 | ||
28 | 30 | ||
29 | 31 | @Callable(i) | |
30 | 32 | func withdraw (amount) = { | |
31 | 33 | let attached = i.payments[0] | |
32 | 34 | let paymentID = i.payments[0].assetId | |
33 | 35 | if ((paymentID != LP)) | |
34 | 36 | then throw("Attach the correct LP token") | |
35 | 37 | else { | |
36 | 38 | let newAmount = (attached.amount - amount) | |
37 | 39 | if ((0 > amount)) | |
38 | 40 | then throw("Can't withdraw negative amount") | |
39 | 41 | else if ((0 > newAmount)) | |
40 | 42 | then throw("Not enough balance") | |
41 | 43 | else { | |
42 | 44 | let burning = Burn(LP, amount) | |
43 | 45 | let transfer = ScriptTransfer(i.caller, newAmount, ID) | |
44 | 46 | [burning, transfer] | |
45 | 47 | } | |
46 | 48 | } | |
47 | 49 | } | |
48 | 50 | ||
49 | 51 | ||
50 | 52 | @Verifier(tx) | |
51 | 53 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
52 | 54 |
github/deemru/w8io/169f3d6 28.35 ms ◑