tx · C1DwMPrJFmsBBEUBAykuueWXABRbe9rUzoqTEPVAHKsG 3NAVJcqMw8AsPecAtd74CeNtAG2qRV2V1so: -0.04000000 Waves 2022.05.20 18:46 [2060199] smart account 3NAVJcqMw8AsPecAtd74CeNtAG2qRV2V1so > SELF 0.00000000 Waves
{ "type": 13, "id": "C1DwMPrJFmsBBEUBAykuueWXABRbe9rUzoqTEPVAHKsG", "fee": 4000000, "feeAssetId": null, "timestamp": 1653061601437, "version": 2, "chainId": 84, "sender": "3NAVJcqMw8AsPecAtd74CeNtAG2qRV2V1so", "senderPublicKey": "EpvN8tsbEWeeqZSLaEVCda8PZfKa1JAF3ZFp7hRq1gWj", "proofs": [ "2QEES54RM8BKJMnFvNpeBbmwgryjWW4x4jXS9H1MTUZwX4S9wSV4efS4VvGBN9fQfprniv4cDurKzK7MMJtwi3QW" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAAAwAAAAAGdXNkbklEAQAAACDbTYM1ZEcblu+fDC+gz33VeZ2S6OGbNQ/BP8x7AnApCwAAAAAGZXRVU0ROAQAAACAK4G3B+vJa1mRJTBFVzWlpaRuAr4r9KwHwm717XF9N5QAAAAAIaXNTdG9wZWQHAAAAAQAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAABAAAAAJhbQgFAAAAA3BtdAAAAAZhbW91bnQEAAAABXRvSXNzCQAAaAAAAAIFAAAAAmFtAAAAAAAAAABkAwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAZ1c2RuSUQJAAACAAAAAQIAAAANSW52YWxpZCB0b2tlbgMFAAAACGlzU3RvcGVkCQAAAgAAAAECAAAAD2RBcHAgaXMgc3RvcHBlZAQAAAABcgkBAAAAB1JlaXNzdWUAAAADBQAAAAZldFVTRE4FAAAAAmFtBgQAAAADdHJ4CQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABXRvSXNzBQAAAAZldFVTRE4JAARMAAAAAgUAAAABcgkABEwAAAACBQAAAAN0cngFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5X6kfFQ==", "height": 2060199, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: A5G4PTzE2uJaFqfd2zS8NkoMZQ39jqMgeiiUKKZMbCMC Next: Gz4dPDe5PSnDbLAbfKpCRhstT7SavPENmpPH1UKz8jxM Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let usdnID = base58'Fm4qczu6Pepz8KUhh3Heb6LeTVfpSMX5vvNgw3x764CS' | |
5 | 5 | ||
6 | - | let | |
6 | + | let etUSDN = base58'jTZeaNjsi7iJK5mTo42VgYjRBHdHawAdhYykMQUnx7v' | |
7 | 7 | ||
8 | - | let isStopped = false | |
9 | - | ||
10 | - | let keyStaked = "STAKED_LP" | |
11 | - | ||
12 | - | let keyCompound = "From_Compound" | |
13 | - | ||
14 | - | let defV = 100000000 | |
8 | + | let isStoped = false | |
15 | 9 | ||
16 | 10 | @Callable(i) | |
17 | - | func | |
11 | + | func deposit () = { | |
18 | 12 | let pmt = value(i.payments[0]) | |
19 | - | let pmtAmount = pmt.amount | |
20 | - | if ((pmt.assetId != token)) | |
21 | - | then throw("attach USDTUSDNLP tokens only") | |
22 | - | else if (isStopped) | |
23 | - | then throw("smart contract is on lock") | |
13 | + | let am = pmt.amount | |
14 | + | let toIss = (am * 100) | |
15 | + | if ((pmt.assetId != usdnID)) | |
16 | + | then throw("Invalid token") | |
17 | + | else if (isStoped) | |
18 | + | then throw("dApp is stopped") | |
24 | 19 | else { | |
25 | - | let tkStaked = match getInteger(this, keyStaked) { | |
26 | - | case n: Int => | |
27 | - | n | |
28 | - | case _ => | |
29 | - | assetBalance(this, token) | |
20 | + | let r = Reissue(etUSDN, am, true) | |
21 | + | let trx = ScriptTransfer(i.caller, toIss, etUSDN) | |
22 | + | [r, trx] | |
30 | 23 | } | |
31 | - | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
32 | - | let updateState = IntegerEntry(keyStaked, ((tkStaked + i.payments[0].amount) - defV)) | |
33 | - | if ((updateState == updateState)) | |
34 | - | then { | |
35 | - | let totalIssued = match assetInfo(lpTCI) { | |
36 | - | case asset: Asset => | |
37 | - | asset.quantity | |
38 | - | case _ => | |
39 | - | throw("Can't find asset") | |
40 | - | } | |
41 | - | let forOne = fraction(totalIssued, 100000000, tkStaked) | |
42 | - | let toIssue = fraction(pmtAmount, forOne, 100000000) | |
43 | - | let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt]) | |
44 | - | if ((LPstake == LPstake)) | |
45 | - | then { | |
46 | - | let LPIssue = Reissue(lpTCI, toIssue, true) | |
47 | - | let transfer = ScriptTransfer(i.caller, toIssue, lpTCI) | |
48 | - | [LPIssue, transfer, updateState] | |
49 | - | } | |
50 | - | else throw("Strict value is not equal to itself.") | |
51 | - | } | |
52 | - | else throw("Strict value is not equal to itself.") | |
53 | - | } | |
54 | - | } | |
55 | - | ||
56 | - | ||
57 | - | ||
58 | - | @Callable(i) | |
59 | - | func compound () = { | |
60 | - | let compound = value(i.payments[0]) | |
61 | - | let ca = compound.amount | |
62 | - | if ((compound.assetId != token)) | |
63 | - | then throw("attach USDTUSDNLP tokens only") | |
64 | - | else { | |
65 | - | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
66 | - | let totalStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
67 | - | let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound]) | |
68 | - | if ((stakeC == stakeC)) | |
69 | - | then { | |
70 | - | let updateState = IntegerEntry(keyStaked, (totalStaked + ca)) | |
71 | - | let tc = IntegerEntry(keyCompound, (fromCompound + ca)) | |
72 | - | [updateState, tc] | |
73 | - | } | |
74 | - | else throw("Strict value is not equal to itself.") | |
75 | - | } | |
76 | 24 | } | |
77 | 25 | ||
78 | 26 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let usdnID = base58'Fm4qczu6Pepz8KUhh3Heb6LeTVfpSMX5vvNgw3x764CS' | |
5 | 5 | ||
6 | - | let | |
6 | + | let etUSDN = base58'jTZeaNjsi7iJK5mTo42VgYjRBHdHawAdhYykMQUnx7v' | |
7 | 7 | ||
8 | - | let isStopped = false | |
9 | - | ||
10 | - | let keyStaked = "STAKED_LP" | |
11 | - | ||
12 | - | let keyCompound = "From_Compound" | |
13 | - | ||
14 | - | let defV = 100000000 | |
8 | + | let isStoped = false | |
15 | 9 | ||
16 | 10 | @Callable(i) | |
17 | - | func | |
11 | + | func deposit () = { | |
18 | 12 | let pmt = value(i.payments[0]) | |
19 | - | let pmtAmount = pmt.amount | |
20 | - | if ((pmt.assetId != token)) | |
21 | - | then throw("attach USDTUSDNLP tokens only") | |
22 | - | else if (isStopped) | |
23 | - | then throw("smart contract is on lock") | |
13 | + | let am = pmt.amount | |
14 | + | let toIss = (am * 100) | |
15 | + | if ((pmt.assetId != usdnID)) | |
16 | + | then throw("Invalid token") | |
17 | + | else if (isStoped) | |
18 | + | then throw("dApp is stopped") | |
24 | 19 | else { | |
25 | - | let tkStaked = match getInteger(this, keyStaked) { | |
26 | - | case n: Int => | |
27 | - | n | |
28 | - | case _ => | |
29 | - | assetBalance(this, token) | |
20 | + | let r = Reissue(etUSDN, am, true) | |
21 | + | let trx = ScriptTransfer(i.caller, toIss, etUSDN) | |
22 | + | [r, trx] | |
30 | 23 | } | |
31 | - | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
32 | - | let updateState = IntegerEntry(keyStaked, ((tkStaked + i.payments[0].amount) - defV)) | |
33 | - | if ((updateState == updateState)) | |
34 | - | then { | |
35 | - | let totalIssued = match assetInfo(lpTCI) { | |
36 | - | case asset: Asset => | |
37 | - | asset.quantity | |
38 | - | case _ => | |
39 | - | throw("Can't find asset") | |
40 | - | } | |
41 | - | let forOne = fraction(totalIssued, 100000000, tkStaked) | |
42 | - | let toIssue = fraction(pmtAmount, forOne, 100000000) | |
43 | - | let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt]) | |
44 | - | if ((LPstake == LPstake)) | |
45 | - | then { | |
46 | - | let LPIssue = Reissue(lpTCI, toIssue, true) | |
47 | - | let transfer = ScriptTransfer(i.caller, toIssue, lpTCI) | |
48 | - | [LPIssue, transfer, updateState] | |
49 | - | } | |
50 | - | else throw("Strict value is not equal to itself.") | |
51 | - | } | |
52 | - | else throw("Strict value is not equal to itself.") | |
53 | - | } | |
54 | - | } | |
55 | - | ||
56 | - | ||
57 | - | ||
58 | - | @Callable(i) | |
59 | - | func compound () = { | |
60 | - | let compound = value(i.payments[0]) | |
61 | - | let ca = compound.amount | |
62 | - | if ((compound.assetId != token)) | |
63 | - | then throw("attach USDTUSDNLP tokens only") | |
64 | - | else { | |
65 | - | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
66 | - | let totalStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
67 | - | let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound]) | |
68 | - | if ((stakeC == stakeC)) | |
69 | - | then { | |
70 | - | let updateState = IntegerEntry(keyStaked, (totalStaked + ca)) | |
71 | - | let tc = IntegerEntry(keyCompound, (fromCompound + ca)) | |
72 | - | [updateState, tc] | |
73 | - | } | |
74 | - | else throw("Strict value is not equal to itself.") | |
75 | - | } | |
76 | 24 | } | |
77 | 25 | ||
78 | 26 | ||
79 | 27 | @Verifier(tx) | |
80 | 28 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
81 | 29 |
github/deemru/w8io/026f985 22.18 ms ◑