tx · ChtgsXGJUACZLGe4qwFoWm8Z1aBgAVZjhzRQ3TR13NJi 3NCCpaecUeQcHCJGnv1ZocqT3xAz2wiXFwe: -0.04000000 Waves 2022.04.15 14:13 [2009597] smart account 3NCCpaecUeQcHCJGnv1ZocqT3xAz2wiXFwe > SELF 0.00000000 Waves
{ "type": 13, "id": "ChtgsXGJUACZLGe4qwFoWm8Z1aBgAVZjhzRQ3TR13NJi", "fee": 4000000, "feeAssetId": null, "timestamp": 1650021179569, "version": 2, "chainId": 84, "sender": "3NCCpaecUeQcHCJGnv1ZocqT3xAz2wiXFwe", "senderPublicKey": "FX5ZmtqMuiefGRPoKkAcBUEDvaHBS4FSzt8VW49mzcjM", "proofs": [ "3Tk541qpiztwQ4Wh8Pv7jDFtCCEreJ4fyE23Cb8SGHupp64PnEngZ4Cnu9GP5KBZZTKJr7GfocRqFD8yxnUiqty1" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAADAAAAAAJJRAEAAAAg/xBHdpoc7iAAQfoZXdECvjjJUsHBvTbctJWSuRHjmWIAAAAAAkxQAQAAACB/UEMJOE42DKjdpdUZpk8du9RWHsMm1kEORh3GqO3pHQAAAAAJaXNTdG9wcGVkBwAAAAIAAAABaQEAAAAFc3Rha2UAAAAABAAAAANwbXQJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACXBtdEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAAAklECQAAAgAAAAECAAAAG2F0dGFjaCB0ZXN0TlNCVCB0b2tlbnMgb25seQMFAAAACWlzU3RvcHBlZAkAAAIAAAABAgAAABlzbWFydCBjb250cmFjdCBpcyBvbiBsb2NrBAAAAAppblRyZWFzdXJ5CQAD8AAAAAIFAAAABHRoaXMFAAAAAklEBAAAAAt0b3RhbElzc3VlZAQAAAAHJG1hdGNoMAk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QAAZgAAAAIAAAAAAAAAAAAFAAAACW5ld0Ftb3VudAkAAAIAAAABAgAAABJOb3QgZW5vdWdoIGJhbGFuY2UEAAAAB2J1cm5pbmcJAQAAAARCdXJuAAAAAgUAAAACTFAFAAAABmFtb3VudAQAAAAIdHJhbnNmZXIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAJbmV3QW1vdW50BQAAAAJJRAkABEwAAAACBQAAAAdidXJuaW5nCQAETAAAAAIFAAAACHRyYW5zZmVyBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlee1jr6o=", "height": 2009597, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CzCHmtJFF1GVHPnQdHZxjxA8JeUSWrFi61FEKzJYWh8G Next: 5fSgVcVzPT8PRVdxvmTKrjQWMwAT39wBLKU1w1aMeXGr Diff:
Old | New | Differences | |
---|---|---|---|
23 | 23 | case _ => | |
24 | 24 | throw("Can't find asset") | |
25 | 25 | } | |
26 | - | let singleLPinValue = (( | |
26 | + | let singleLPinValue = ((inTreasury * 100000000) / totalIssued) | |
27 | 27 | let amountToIssue = ((pmtAmount * singleLPinValue) / 100000000) | |
28 | 28 | let LPIssue = Reissue(LP, amountToIssue, true) | |
29 | 29 | let transfer = ScriptTransfer(i.caller, amountToIssue, LP) |
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'9ZymB4TJF6oQ3HwYgYFKizAf6m64sQF896mUzcsDJ4Wx' | |
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 = match assetInfo(LP) { | |
21 | 21 | case asset: Asset => | |
22 | 22 | asset.quantity | |
23 | 23 | case _ => | |
24 | 24 | throw("Can't find asset") | |
25 | 25 | } | |
26 | - | let singleLPinValue = (( | |
26 | + | let singleLPinValue = ((inTreasury * 100000000) / totalIssued) | |
27 | 27 | let amountToIssue = ((pmtAmount * singleLPinValue) / 100000000) | |
28 | 28 | let LPIssue = Reissue(LP, amountToIssue, true) | |
29 | 29 | let transfer = ScriptTransfer(i.caller, amountToIssue, LP) | |
30 | 30 | [LPIssue, transfer] | |
31 | 31 | } | |
32 | 32 | } | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | ||
36 | 36 | @Callable(i) | |
37 | 37 | func withdraw (amount) = { | |
38 | 38 | let attached = i.payments[0] | |
39 | 39 | let paymentID = i.payments[0].assetId | |
40 | 40 | if ((paymentID != LP)) | |
41 | 41 | then throw("Attach the correct LP token") | |
42 | 42 | else { | |
43 | 43 | let newAmount = (attached.amount - amount) | |
44 | 44 | if ((0 > amount)) | |
45 | 45 | then throw("Can't withdraw negative amount") | |
46 | 46 | else if ((0 > newAmount)) | |
47 | 47 | then throw("Not enough balance") | |
48 | 48 | else { | |
49 | 49 | let burning = Burn(LP, amount) | |
50 | 50 | let transfer = ScriptTransfer(i.caller, newAmount, ID) | |
51 | 51 | [burning, transfer] | |
52 | 52 | } | |
53 | 53 | } | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Verifier(tx) | |
58 | 58 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
59 | 59 |
github/deemru/w8io/026f985 43.23 ms ◑