tx · FUwsi7hHBJJ1RBbJcG7ox3VHDwKiQ4HRbYJoddptBm7Z
3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH: -0.01400000 Waves
2022.04.08 13:26 [1999469] smart account 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH > SELF 0.00000000 Waves
{
"type": 13,
"id": "FUwsi7hHBJJ1RBbJcG7ox3VHDwKiQ4HRbYJoddptBm7Z",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1649413634062,
"version": 2,
"chainId": 84,
"sender": "3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH",
"senderPublicKey": "HJ4JLtArYaaiBiWho6gzLRbKUVM6ZVTaKmci6sgFQtEm",
"proofs": [
"ZTtHiiPbKv5i95qT7TiPeQ6fRcz9fCL2p4EwjmaBtfXfhqaPtck8ksP4Ch6ZVnhyq1qPiU6wPbX7r8WEmBpUkzg"
],
"script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAADAAAAAAJJRAEAAAAAAAAAAAJMUAEAAAAAAAAAAAlpc1N0b3BwZWQHAAAAAgAAAAFpAQAAAAVzdGFrZQAAAAAEAAAAA3BtdAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAJcG10QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAHYXNzZXRJZAUAAAACSUQJAAACAAAAAQIAAAAbYXR0YWNoIHRlc3ROU0JUIHRva2VucyBvbmx5AwUAAAAJaXNTdG9wcGVkCQAAAgAAAAECAAAAGXNtYXJ0IGNvbnRyYWN0IGlzIG9uIGxvY2sEAAAACmluVHJlYXN1cnkJAAPwAAAAAgUAAAAEdGhpcwUAAAACSUQEAAAAC3RvdGFsSXNzdWVkBAAAAAckbWF0Y2gwCQAD7AAAAAEFAAAAAkxQAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAVB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ETAAAAAIFAAAACHRyYW5zZmVyBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleWAxv4o=",
"height": 1999469,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: FHaL2fzkoj2hxfjqxuKfyS7k3mhsfdTDZLDYFVx9eiGc
Next: i2LHhxia2wjJGhr2pGU92YHF1oucRM4eZAG84mZ2Fqo
Diff:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let ID = base58'JAfMu2seKNzTVfqi5w5Pjh4kwwPTZPCEFpc2q2vDyFeh' |
---|
| 4 | + | let ID = base58'' |
---|
5 | 5 | | |
---|
6 | | - | let LP = base58'6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU' |
---|
| 6 | + | let LP = base58'' |
---|
7 | 7 | | |
---|
8 | 8 | | let isStopped = false |
---|
9 | 9 | | |
---|
|
23 | 23 | | case _ => |
---|
24 | 24 | | throw("Can't find asset") |
---|
25 | 25 | | } |
---|
26 | | - | let singleLPinValue = (inTreasury / totalIssued) |
---|
27 | | - | let LPIssue = Reissue(LP, singleLPinValue, true) |
---|
28 | | - | let transfer = ScriptTransfer(i.caller, singleLPinValue, LP) |
---|
| 26 | + | let LPIssue = Reissue(LP, pmtAmount, true) |
---|
| 27 | + | let transfer = ScriptTransfer(i.caller, pmtAmount, LP) |
---|
29 | 28 | | [LPIssue, transfer] |
---|
30 | 29 | | } |
---|
31 | 30 | | } |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let ID = base58'JAfMu2seKNzTVfqi5w5Pjh4kwwPTZPCEFpc2q2vDyFeh' |
---|
| 4 | + | let ID = base58'' |
---|
5 | 5 | | |
---|
6 | | - | let LP = base58'6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU' |
---|
| 6 | + | let LP = base58'' |
---|
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 = (inTreasury / totalIssued) |
---|
27 | | - | let LPIssue = Reissue(LP, singleLPinValue, true) |
---|
28 | | - | let transfer = ScriptTransfer(i.caller, singleLPinValue, LP) |
---|
| 26 | + | let LPIssue = Reissue(LP, pmtAmount, true) |
---|
| 27 | + | let transfer = ScriptTransfer(i.caller, pmtAmount, LP) |
---|
29 | 28 | | [LPIssue, transfer] |
---|
30 | 29 | | } |
---|
31 | 30 | | } |
---|
32 | 31 | | |
---|
33 | 32 | | |
---|
34 | 33 | | |
---|
35 | 34 | | @Callable(i) |
---|
36 | 35 | | func withdraw (amount) = { |
---|
37 | 36 | | let attached = i.payments[0] |
---|
38 | 37 | | let paymentID = i.payments[0].assetId |
---|
39 | 38 | | if ((paymentID != LP)) |
---|
40 | 39 | | then throw("Attach the correct LP token") |
---|
41 | 40 | | else { |
---|
42 | 41 | | let newAmount = (attached.amount - amount) |
---|
43 | 42 | | if ((0 > amount)) |
---|
44 | 43 | | then throw("Can't withdraw negative amount") |
---|
45 | 44 | | else if ((0 > newAmount)) |
---|
46 | 45 | | then throw("Not enough balance") |
---|
47 | 46 | | else { |
---|
48 | 47 | | let burning = Burn(LP, amount) |
---|
49 | 48 | | let transfer = ScriptTransfer(i.caller, newAmount, ID) |
---|
50 | 49 | | [burning, transfer] |
---|
51 | 50 | | } |
---|
52 | 51 | | } |
---|
53 | 52 | | } |
---|
54 | 53 | | |
---|
55 | 54 | | |
---|
56 | 55 | | @Verifier(tx) |
---|
57 | 56 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
58 | 57 | | |
---|