tx · 9NnHueLGEi62d3ggwunUKwNLujFro7PbZXVTLqLSZzRE 3MwBGvHwMsCkfpjNczpKyPwjZn8kguZc1aT: -0.04000000 Waves 2022.05.19 12:21 [2058371] smart account 3MwBGvHwMsCkfpjNczpKyPwjZn8kguZc1aT > SELF 0.00000000 Waves
{ "type": 13, "id": "9NnHueLGEi62d3ggwunUKwNLujFro7PbZXVTLqLSZzRE", "fee": 4000000, "feeAssetId": null, "timestamp": 1652952070566, "version": 2, "chainId": 84, "sender": "3MwBGvHwMsCkfpjNczpKyPwjZn8kguZc1aT", "senderPublicKey": "HR6KqHHmjzGx8fdbFkG9LMHCiNx2t8ExYHP5fWMomCJu", "proofs": [ "4DoL1m8u6W5jHiSarZDUwyBxpzSrXBDXm849TiAmAULtWtLS2cTn96QdwBWZxf8sXoxRzJieoB83mC3npcntbQDz" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAFAAAAAAV0b2tlbgEAAAAg202DNWRHG5bvnwwvoM991XmdkujhmzUPwT/MewJwKQsAAAAABWxwVENJAQAAACAaMxpM7J2AkwQeyUXAgj0RTdaP0uNhJJ62DJZuUfMG8AAAAAAJaXNTdG9wcGVkBwAAAAAJa2V5U3Rha2VkAgAAAAlTVEFLRURfTFAAAAAAC2tleUNvbXBvdW5kAgAAAA1Gcm9tX0NvbXBvdW5kAAAAAgAAAAFpAQAAAAVzdGFrZQAAAAAEAAAAA3BtdAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAJcG10QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAHYXNzZXRJZAUAAAAFdG9rZW4JAAACAAAAAQIAAAAdYXR0YWNoIFVTRFRVU0ROTFAgdG9rZW5zIG9ubHkDBQAAAAlpc1N0b3BwZWQJAAACAAAAAQIAAAAZc21hcnQgY29udHJhY3QgaXMgb24gbG9jawQAAAAIdGtTdGFr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lU3RhdGUJAARMAAAAAgUAAAACdGMFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAAigQwGA==", "height": 2058371, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4W9v1aAwno6c7kkZTit8tQjP9RXckV8hADLjFr4s4fiX Next: GLQGCerPZxBeq6T51izriESQFkkfBux6QFDu22QfovYb Diff:
Old | New | Differences | |
---|---|---|---|
25 | 25 | let updateState = IntegerEntry(keyStaked, (tkStaked + i.payments[0].amount)) | |
26 | 26 | if ((updateState == updateState)) | |
27 | 27 | then { | |
28 | - | let totalIssued = match assetInfo(lpTCI) { | |
29 | - | case asset: Asset => | |
30 | - | asset.quantity | |
31 | - | case _ => | |
32 | - | throw("Can't find asset") | |
33 | - | } | |
34 | - | let treasury = (tkStaked + assetBalance(this, token)) | |
35 | - | let forOne = fraction(totalIssued, 100000000, treasury) | |
28 | + | let totalIssued = (tkStaked - fromCompound) | |
29 | + | let forOne = fraction(totalIssued, 100000000, tkStaked) | |
36 | 30 | let toIssue = fraction(pmtAmount, forOne, 100000000) | |
37 | 31 | let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt]) | |
38 | 32 | if ((LPstake == LPstake)) |
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'2mGo9byNgTSxPC4J8wXkGkdjhB3Tk3gjGYiiHsyCrnHd' | |
7 | 7 | ||
8 | 8 | let isStopped = false | |
9 | 9 | ||
10 | 10 | let keyStaked = "STAKED_LP" | |
11 | 11 | ||
12 | 12 | let keyCompound = "From_Compound" | |
13 | 13 | ||
14 | 14 | @Callable(i) | |
15 | 15 | func stake () = { | |
16 | 16 | let pmt = value(i.payments[0]) | |
17 | 17 | let pmtAmount = pmt.amount | |
18 | 18 | if ((pmt.assetId != token)) | |
19 | 19 | then throw("attach USDTUSDNLP tokens only") | |
20 | 20 | else if (isStopped) | |
21 | 21 | then throw("smart contract is on lock") | |
22 | 22 | else { | |
23 | 23 | let tkStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
24 | 24 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
25 | 25 | let updateState = IntegerEntry(keyStaked, (tkStaked + i.payments[0].amount)) | |
26 | 26 | if ((updateState == updateState)) | |
27 | 27 | then { | |
28 | - | let totalIssued = match assetInfo(lpTCI) { | |
29 | - | case asset: Asset => | |
30 | - | asset.quantity | |
31 | - | case _ => | |
32 | - | throw("Can't find asset") | |
33 | - | } | |
34 | - | let treasury = (tkStaked + assetBalance(this, token)) | |
35 | - | let forOne = fraction(totalIssued, 100000000, treasury) | |
28 | + | let totalIssued = (tkStaked - fromCompound) | |
29 | + | let forOne = fraction(totalIssued, 100000000, tkStaked) | |
36 | 30 | let toIssue = fraction(pmtAmount, forOne, 100000000) | |
37 | 31 | let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt]) | |
38 | 32 | if ((LPstake == LPstake)) | |
39 | 33 | then { | |
40 | 34 | let LPIssue = Reissue(lpTCI, toIssue, true) | |
41 | 35 | let transfer = ScriptTransfer(i.caller, toIssue, lpTCI) | |
42 | 36 | [LPIssue, transfer, updateState] | |
43 | 37 | } | |
44 | 38 | else throw("Strict value is not equal to itself.") | |
45 | 39 | } | |
46 | 40 | else throw("Strict value is not equal to itself.") | |
47 | 41 | } | |
48 | 42 | } | |
49 | 43 | ||
50 | 44 | ||
51 | 45 | ||
52 | 46 | @Callable(i) | |
53 | 47 | func compound () = { | |
54 | 48 | let compound = value(i.payments[0]) | |
55 | 49 | let ca = compound.amount | |
56 | 50 | if ((compound.assetId != token)) | |
57 | 51 | then throw("attach USDTUSDNLP tokens only") | |
58 | 52 | else { | |
59 | 53 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
60 | 54 | let totalStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
61 | 55 | let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound]) | |
62 | 56 | if ((stakeC == stakeC)) | |
63 | 57 | then { | |
64 | 58 | let updateState = IntegerEntry(keyStaked, (totalStaked + ca)) | |
65 | 59 | let tc = IntegerEntry(keyCompound, (fromCompound + ca)) | |
66 | 60 | [updateState, tc] | |
67 | 61 | } | |
68 | 62 | else throw("Strict value is not equal to itself.") | |
69 | 63 | } | |
70 | 64 | } | |
71 | 65 | ||
72 | 66 |
github/deemru/w8io/169f3d6 36.09 ms ◑