tx · 5VeLZ7no8kAkU1YxHVJxYaZgnZSmUAJEPWZHS6UBJSdo
3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH: -0.01400000 Waves
2022.04.08 15:45 [1999610] smart account 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH > SELF 0.00000000 Waves
{
"type": 13,
"id": "5VeLZ7no8kAkU1YxHVJxYaZgnZSmUAJEPWZHS6UBJSdo",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1649421941922,
"version": 2,
"chainId": 84,
"sender": "3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH",
"senderPublicKey": "HJ4JLtArYaaiBiWho6gzLRbKUVM6ZVTaKmci6sgFQtEm",
"proofs": [
"3Vb2kAoqXwjgSkzQYAES4sbiniGtyaDYQicgfwTEJktoy3n8dq1Er26R9JtR2Z2W53TCe17hYte8JU6Ptb6PuXn"
],
"script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAADAAAAAAJJRAEAAAAg/xBHdpoc7iAAQfoZXdECvjjJUsHBvTbctJWSuRHjmWIAAAAAAkxQAQAAACBUgJin8ZP4V+99JlgBkqGEJd4kKpy7bL9Mn0vxHVzLPwAAAAAJaXNTdG9wcGVkBwAAAAIAAAABaQEAAAAFc3Rha2UAAAAABAAAAANwbXQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACXBtdEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAAAklECQAAAgAAAAECAAAAG2F0dGFjaCB0ZXN0TlNCVCB0b2tlbnMgb25seQMFAAAACWlzU3RvcHBlZAkAAAIAAAABAgAAABlzbWFydCBjb250cmFjdCBpcyBvbiBsb2NrBAAAAAppblRyZWFzdXJ5CQAD8AAAAAIFAAAABHRoaXMFAAAAAklEBAAAAAt0b3RhbElzc3VlZAkBAAAADEludGVnZXJFbnRyeQA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AAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAJbmV3QW1vdW50BQAAAAJJRAkABEwAAAACBQAAAAdidXJuaW5nCQAETAAAAAIFAAAACHRyYW5zZmVyBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleRekAC4=",
"height": 1999610,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: FkCE3w9EFDeKs93QUvyTxqF59wqxxnKPDL9EXfkaZ9vS
Next: 57e4EAmJV1U94T2inp1oycCAviJHcpQZJnwzkd7JgUam
Diff:
Old | New | | Differences |
---|
18 | 18 | | else { |
---|
19 | 19 | | let inTreasury = assetBalance(this, ID) |
---|
20 | 20 | | let totalIssued = IntegerEntry("6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU", 100) |
---|
21 | | - | let issue = ((totalIssued.value / inTreasury) * pmtAmount) |
---|
22 | | - | let LPIssue = Reissue(LP, issue, true) |
---|
23 | | - | let transfer = ScriptTransfer(i.caller, issue, LP) |
---|
| 21 | + | let test = totalIssued.value |
---|
| 22 | + | let singleLPinValue = (test / inTreasury) |
---|
| 23 | + | let LPIssue = Reissue(LP, singleLPinValue, true) |
---|
| 24 | + | let transfer = ScriptTransfer(i.caller, pmtAmount, LP) |
---|
24 | 25 | | [LPIssue, transfer] |
---|
25 | 26 | | } |
---|
26 | 27 | | } |
---|
Full:
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 = 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 issue = ((totalIssued.value / inTreasury) * pmtAmount) |
---|
22 | | - | let LPIssue = Reissue(LP, issue, true) |
---|
23 | | - | let transfer = ScriptTransfer(i.caller, issue, LP) |
---|
| 21 | + | let test = totalIssued.value |
---|
| 22 | + | let singleLPinValue = (test / inTreasury) |
---|
| 23 | + | let LPIssue = Reissue(LP, singleLPinValue, true) |
---|
| 24 | + | let transfer = ScriptTransfer(i.caller, pmtAmount, LP) |
---|
24 | 25 | | [LPIssue, transfer] |
---|
25 | 26 | | } |
---|
26 | 27 | | } |
---|
27 | 28 | | |
---|
28 | 29 | | |
---|
29 | 30 | | |
---|
30 | 31 | | @Callable(i) |
---|
31 | 32 | | func withdraw (amount) = { |
---|
32 | 33 | | let attached = i.payments[0] |
---|
33 | 34 | | let paymentID = i.payments[0].assetId |
---|
34 | 35 | | if ((paymentID != LP)) |
---|
35 | 36 | | then throw("Attach the correct LP token") |
---|
36 | 37 | | else { |
---|
37 | 38 | | let newAmount = (attached.amount - amount) |
---|
38 | 39 | | if ((0 > amount)) |
---|
39 | 40 | | then throw("Can't withdraw negative amount") |
---|
40 | 41 | | else if ((0 > newAmount)) |
---|
41 | 42 | | then throw("Not enough balance") |
---|
42 | 43 | | else { |
---|
43 | 44 | | let burning = Burn(LP, amount) |
---|
44 | 45 | | let transfer = ScriptTransfer(i.caller, newAmount, ID) |
---|
45 | 46 | | [burning, transfer] |
---|
46 | 47 | | } |
---|
47 | 48 | | } |
---|
48 | 49 | | } |
---|
49 | 50 | | |
---|
50 | 51 | | |
---|
51 | 52 | | @Verifier(tx) |
---|
52 | 53 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
53 | 54 | | |
---|