tx · BuaDmbhd69kVqveDso2s3bWmKgo7912G87TnXXNAzZTK 3NAVJcqMw8AsPecAtd74CeNtAG2qRV2V1so: -0.04000000 Waves 2022.05.20 12:31 [2059818] smart account 3NAVJcqMw8AsPecAtd74CeNtAG2qRV2V1so > SELF 0.00000000 Waves
{ "type": 13, "id": "BuaDmbhd69kVqveDso2s3bWmKgo7912G87TnXXNAzZTK", "fee": 4000000, "feeAssetId": null, "timestamp": 1653039104005, "version": 2, "chainId": 84, "sender": "3NAVJcqMw8AsPecAtd74CeNtAG2qRV2V1so", "senderPublicKey": "EpvN8tsbEWeeqZSLaEVCda8PZfKa1JAF3ZFp7hRq1gWj", "proofs": [ "615mXFG2FARnRoXXLd81B2Pebmn6KMn4HXKqLvmDbCi45s87vxx7aSduyuNk2KezysdR2fKZE3hic8rXYpaEjvpu" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAGAAAAAAV0b2tlbgEAAAAg202DNWRHG5bvnwwvoM991XmdkujhmzUPwT/MewJwKQsAAAAABWxwVENJAQAAACBYukfmA8VHrjQiYf9ySqYH4A864xu2rNSaNwUvI60S5AAAAAAJaXNTdG9wcGVkBwAAAAAJa2V5U3Rha2VkAgAAAAlTVEFLRURfTFAAAAAAC2tleUNvbXBvdW5kAgAAAA1Gcm9tX0NvbXBvdW5kAAAAAARkZWZWAAAAAAAF9eEAAAAAAgAAAAFpAQAAAAVzdGFrZQAAAAAEAAAAA3BtdAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAJcG10QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAHYXNzZXRJZAUAAAAFdG9rZW4JAAACAAAAAQIAAAAdYXR0YWNoIFVTRFRVU0ROTFAgdG9rZW5zIG9ubHkDBQAAAAlpc1N0b3BwZWQJAAACAAAAAQIAAAAZc21hcnQgY29udHJhY3QgaXMgb24gbG9jawQ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mQJAABkAAAAAgUAAAAMZnJvbUNvbXBvdW5kBQAAAAJjYQkABEwAAAACBQAAAAt1cGRhdGVTdGF0ZQkABEwAAAACBQAAAAJ0YwUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V50TpM8Q==", "height": 2059818, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6GXtYpwrV33g1VP3cc6TvfQzk4DcGN9WX37VKqzHqWWT Next: 8RChVL79K2UVaZyMd41NALgzb1LWj8rXk6o4qTPpoYys Diff:
Old | New | Differences | |
---|---|---|---|
22 | 22 | else if (isStopped) | |
23 | 23 | then throw("smart contract is on lock") | |
24 | 24 | else { | |
25 | - | let tkStaked = match getInteger(this, keyStaked) { | |
26 | - | case n: Int => | |
27 | - | n | |
28 | - | case _ => | |
29 | - | assetBalance(this, token) | |
30 | - | } | |
25 | + | let tkStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
31 | 26 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
32 | - | let updateState = IntegerEntry(keyStaked, | |
27 | + | let updateState = IntegerEntry(keyStaked, 0) | |
33 | 28 | if ((updateState == updateState)) | |
34 | 29 | then { | |
35 | 30 | let totalIssued = match assetInfo(lpTCI) { |
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'6yMdFxB7ULdLQ8mMjkLtoQvTy9WFrBKoTRK5JXnwMPAb' | |
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 | let defV = 100000000 | |
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 | - | let tkStaked = match getInteger(this, keyStaked) { | |
26 | - | case n: Int => | |
27 | - | n | |
28 | - | case _ => | |
29 | - | assetBalance(this, token) | |
30 | - | } | |
25 | + | let tkStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
31 | 26 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
32 | - | let updateState = IntegerEntry(keyStaked, | |
27 | + | let updateState = IntegerEntry(keyStaked, 0) | |
33 | 28 | if ((updateState == updateState)) | |
34 | 29 | then { | |
35 | 30 | let totalIssued = match assetInfo(lpTCI) { | |
36 | 31 | case asset: Asset => | |
37 | 32 | asset.quantity | |
38 | 33 | case _ => | |
39 | 34 | throw("Can't find asset") | |
40 | 35 | } | |
41 | 36 | let forOne = fraction(totalIssued, 100000000, tkStaked) | |
42 | 37 | let toIssue = fraction(pmtAmount, forOne, 100000000) | |
43 | 38 | let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt]) | |
44 | 39 | if ((LPstake == LPstake)) | |
45 | 40 | then { | |
46 | 41 | let LPIssue = Reissue(lpTCI, toIssue, true) | |
47 | 42 | let transfer = ScriptTransfer(i.caller, toIssue, lpTCI) | |
48 | 43 | [LPIssue, transfer, updateState] | |
49 | 44 | } | |
50 | 45 | else throw("Strict value is not equal to itself.") | |
51 | 46 | } | |
52 | 47 | else throw("Strict value is not equal to itself.") | |
53 | 48 | } | |
54 | 49 | } | |
55 | 50 | ||
56 | 51 | ||
57 | 52 | ||
58 | 53 | @Callable(i) | |
59 | 54 | func compound () = { | |
60 | 55 | let compound = value(i.payments[0]) | |
61 | 56 | let ca = compound.amount | |
62 | 57 | if ((compound.assetId != token)) | |
63 | 58 | then throw("attach USDTUSDNLP tokens only") | |
64 | 59 | else { | |
65 | 60 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
66 | 61 | let totalStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
67 | 62 | let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound]) | |
68 | 63 | if ((stakeC == stakeC)) | |
69 | 64 | then { | |
70 | 65 | let updateState = IntegerEntry(keyStaked, (totalStaked + ca)) | |
71 | 66 | let tc = IntegerEntry(keyCompound, (fromCompound + ca)) | |
72 | 67 | [updateState, tc] | |
73 | 68 | } | |
74 | 69 | else throw("Strict value is not equal to itself.") | |
75 | 70 | } | |
76 | 71 | } | |
77 | 72 | ||
78 | 73 | ||
79 | 74 | @Verifier(tx) | |
80 | 75 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
81 | 76 |
github/deemru/w8io/169f3d6 42.67 ms ◑