tx · Hk95xLQUaPgTFdGPdg1pZnujAirfrhq19rRbgpcETUTe 3N9E2aUbiyf6wn4bSqyATFBEQFUKYy9datz: -0.01000000 Waves 2022.05.16 12:31 [2054046] smart account 3N9E2aUbiyf6wn4bSqyATFBEQFUKYy9datz > SELF 0.00000000 Waves
{ "type": 13, "id": "Hk95xLQUaPgTFdGPdg1pZnujAirfrhq19rRbgpcETUTe", "fee": 1000000, "feeAssetId": null, "timestamp": 1652693520713, "version": 2, "chainId": 84, "sender": "3N9E2aUbiyf6wn4bSqyATFBEQFUKYy9datz", "senderPublicKey": "4RUVreqGaYfi1yVRnNWAip2edczRrUTTiiZwKnd4YD3u", "proofs": [ "4NBwDAzzGetQoBAqtbGBzd8aS7Xks2ZUe6rxngn6rCizpYgqUsgdhawuXSCBweDKxQ4vAA5wHZgT1TppdRdyCLEx" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAGAAAAAAV0b2tlbgEAAAAg202DNWRHG5bvnwwvoM991XmdkujhmzUPwT/MewJwKQsAAAAABWxwVENJAQAAACAOsaLbFoDp18KsM3EhDM01PSoVCLVgs2ksT7H2wwTB/AAAAAAEZGFwcAEAAAAaAVRZQCeTa0sp7r6xoQ7m3EC4z6SNegzrtQ8AAAAACWlzU3RvcHBlZAcAAAAACWtleVN0YWtlZAIAAAAJU1RBS0VEX0xQAAAAAAtrZXlDb21wb3VuZAIAAAANRnJvbV9Db21wb3VuZAAAAAIAAAABaQEAAAAFc3Rha2UAAAAABAAAAANwbXQJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACXBtdEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAABXRva2VuCQAAAgAAAAECAAAAHWF0dGFjaCBVU0RUVVNETkxQIHRva2VucyBvbmx5AwUAAAAJaXNTdG9wcGVkCQAAAgAAAAECAAAA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kYXRlU3RhdGUEAAAAD3RvdGFsT2ZDb21wb3VuZAkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAAC2tleUNvbXBvdW5kCQAAZAAAAAIFAAAADGZyb21Db21wb3VuZAUAAAAOY29tcG91bmRBbW91bnQDCQAAAAAAAAIFAAAAD3RvdGFsT2ZDb21wb3VuZAUAAAAPdG90YWxPZkNvbXBvdW5kCQAETAAAAAIFAAAAC3VwZGF0ZVN0YXRlCQAETAAAAAIFAAAAD3RvdGFsT2ZDb21wb3VuZAUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAA3V2+SA==", "height": 2054046, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AXwdzPFWbf7tszCotwXpZTWh8cDFvL1Q9qmkwrhbWgA4 Next: AJ2RbB2imfCgnZujSaUSrrTYhpi1Du11FEnrCWH77wyu Diff:
Old | New | Differences | |
---|---|---|---|
59 | 59 | else { | |
60 | 60 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
61 | 61 | let totalStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
62 | - | let updateState = IntegerEntry(keyStaked, (totalStaked + | |
62 | + | let updateState = IntegerEntry(keyStaked, (totalStaked + i.payments[0].amount)) | |
63 | 63 | if ((updateState == updateState)) | |
64 | 64 | then { | |
65 | 65 | let totalOfCompound = IntegerEntry(keyCompound, (fromCompound + compoundAmount)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let token = base58'Fm4qczu6Pepz8KUhh3Heb6LeTVfpSMX5vvNgw3x764CS' | |
5 | 5 | ||
6 | 6 | let lpTCI = base58'zMoz8KokhTvMU6GosBdAHrWfg8aCWSpP1nBigwwi63D' | |
7 | 7 | ||
8 | 8 | let dapp = base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz' | |
9 | 9 | ||
10 | 10 | let isStopped = false | |
11 | 11 | ||
12 | 12 | let keyStaked = "STAKED_LP" | |
13 | 13 | ||
14 | 14 | let keyCompound = "From_Compound" | |
15 | 15 | ||
16 | 16 | @Callable(i) | |
17 | 17 | func stake () = { | |
18 | 18 | let pmt = value(i.payments[0]) | |
19 | 19 | let pmtAmount = pmt.amount | |
20 | 20 | if ((pmt.assetId != token)) | |
21 | 21 | then throw("attach USDTUSDNLP tokens only") | |
22 | 22 | else if (isStopped) | |
23 | 23 | then throw("smart contract is on lock") | |
24 | 24 | else { | |
25 | 25 | let tkStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
26 | 26 | let updateState = IntegerEntry(keyStaked, (tkStaked + i.payments[0].amount)) | |
27 | 27 | if ((updateState == updateState)) | |
28 | 28 | then { | |
29 | 29 | let totalIssued = match assetInfo(lpTCI) { | |
30 | 30 | case asset: Asset => | |
31 | 31 | asset.quantity | |
32 | 32 | case _ => | |
33 | 33 | throw("Can't find asset") | |
34 | 34 | } | |
35 | 35 | let treasury = (((tkStaked + assetBalance(this, token)) + pmtAmount) - pmtAmount) | |
36 | 36 | let forOne = fraction(totalIssued, 100000000, treasury) | |
37 | 37 | let toIssue = fraction(pmtAmount, forOne, 100000000) | |
38 | 38 | let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt]) | |
39 | 39 | if ((LPstake == LPstake)) | |
40 | 40 | then { | |
41 | 41 | let LPIssue = Reissue(lpTCI, toIssue, true) | |
42 | 42 | let transfer = ScriptTransfer(i.caller, toIssue, lpTCI) | |
43 | 43 | [LPIssue, transfer, updateState] | |
44 | 44 | } | |
45 | 45 | else throw("Strict value is not equal to itself.") | |
46 | 46 | } | |
47 | 47 | else throw("Strict value is not equal to itself.") | |
48 | 48 | } | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | ||
53 | 53 | @Callable(i) | |
54 | 54 | func compound () = { | |
55 | 55 | let compound = value(i.payments[0]) | |
56 | 56 | let compoundAmount = compound.amount | |
57 | 57 | if ((compound.assetId != token)) | |
58 | 58 | then throw("attach USDTUSDNLP tokens only") | |
59 | 59 | else { | |
60 | 60 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
61 | 61 | let totalStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
62 | - | let updateState = IntegerEntry(keyStaked, (totalStaked + | |
62 | + | let updateState = IntegerEntry(keyStaked, (totalStaked + i.payments[0].amount)) | |
63 | 63 | if ((updateState == updateState)) | |
64 | 64 | then { | |
65 | 65 | let totalOfCompound = IntegerEntry(keyCompound, (fromCompound + compoundAmount)) | |
66 | 66 | if ((totalOfCompound == totalOfCompound)) | |
67 | 67 | then [updateState, totalOfCompound] | |
68 | 68 | else throw("Strict value is not equal to itself.") | |
69 | 69 | } | |
70 | 70 | else throw("Strict value is not equal to itself.") | |
71 | 71 | } | |
72 | 72 | } | |
73 | 73 | ||
74 | 74 |
github/deemru/w8io/026f985 33.27 ms ◑