tx · 7RDvmhKMvLc4ZUw1ENArFHKnfcjAV4KEdA4okpThQsn5

3Mz29fiz3zgY9JDbiHKANvHsFgQutdfu4Ua:  -0.01400000 Waves

2021.03.18 18:59 [1443387] smart account 3Mz29fiz3zgY9JDbiHKANvHsFgQutdfu4Ua > SELF 0.00000000 Waves

{ "type": 13, "id": "7RDvmhKMvLc4ZUw1ENArFHKnfcjAV4KEdA4okpThQsn5", "fee": 1400000, "feeAssetId": null, "timestamp": 1616083209024, "version": 2, "chainId": 84, "sender": "3Mz29fiz3zgY9JDbiHKANvHsFgQutdfu4Ua", "senderPublicKey": "CTyHhnVTxf16Z4CmGGneAK8WB5g2QyT4MB8kUn8vPPcu", "proofs": [ "3gc8EifwsH9Ad6NwETdW4xxqWEREz1Zd4cJDCi8XdcxfeAK2kXExaZXc6PYV5YMicgJ74ek4BWXFagbvJNKFJN1D" ], "script": "base64:AAIEAAAAAAAAAAQIAhIAAAAAAAAAAAEAAAABaQEAAAAEY2FsbAAAAAAEAAAABWFzc2V0CQAEQwAAAAcCAAAABUFzc2V0AgAAAAAAAAAAAAAAAAEAAAAAAAAAAAAGBQAAAAR1bml0AAAAAAAAAAAABAAAAAdhc3NldElkCQAEOAAAAAEFAAAABWFzc2V0CQAETAAAAAIJAQAAAAtCaW5hcnlFbnRyeQAAAAICAAAAA2JpbgEAAAAACQAETAAAAAIJAQAAAAxCb29sZWFuRW50cnkAAAACAgAAAARib29sBgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAADaW50AAAAAAAAAAABCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAAA3N0cgIAAAAACQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAECAAAAA3N0cgkABEwAAAACBQAAAAVhc3NldAkABEwAAAACCQEAAAAHUmVpc3N1ZQAAAAMFAAAAB2Fzc2V0SWQAAAAAAAAAAAEHCQAETAAAAAIJAQAAAARCdXJuAAAAAgUAAAAHYXNzZXRJZAAAAAAAAAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAEFAAAAB2Fzc2V0SWQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5KOU8bg==", "height": 1443387, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B54LQr15EsadxDybBcq2uZwve92WCf3pDJKVieaFBVKo Next: 9K1oVkzM8m7VVavNsWQodwToBUQa8RcsRdRHmaotLdDY Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let separator = "___"
5-
6-let hardcoredMaximumDepositFee = 100
7-
8-let hardcoredDappName = "FOKOFF"
9-
10-let hardcoredAssetIdForWaves = "WAVES"
11-
12-let keyAssetToStake = (hardcoredDappName + "_AssetToStake_")
13-
14-let keyAssetsToStakeList = (hardcoredDappName + "_AssetsToStakeList")
15-
16-let keyDefaultDepositFee = (hardcoredDappName + "_DefaultDepositFee")
17-
18-let keySuffixIsEnabled = "_isEnabled"
19-
20-let keySuffixMinAmount = "_minimumAmount"
21-
22-let keySuffixAfterHeight = "_allowStakingAfterBlockHeight"
23-
24-let keySuffixBlockDelay = "_BlocksDelayAfterDepositToStake"
25-
26-let keySuffixEnableSpecFee = "_enableSpecificDepositFee"
27-
28-let keySuffixSpecFee = "_specificDepositFee"
29-
30-let keyTreasury = (hardcoredDappName + "_Treasury_")
31-
32-let keySettingsAddress = (hardcoredDappName + "_SettingsAddress")
33-
34-let keyNonce = (hardcoredDappName + "_Nonce")
35-
36-let keyStakingAmount = (hardcoredDappName + "_StakingAmount_")
37-
38-let keyIssuedStakingContract = (hardcoredDappName + "_IssuedSContract_")
39-
40-let keyBurnedStakingContract = (hardcoredDappName + "_BurnedSContract_")
41-
42-let keyATSContractName = (hardcoredDappName + "Contract1")
43-
44-func getSettingsAddress () = Address(fromBase58String(getStringValue(this, keySettingsAddress)))
45-
46-
47-func isSelf (caller) = if ((this == caller))
48- then true
49- else (caller == getSettingsAddress())
50-
51-
52-func calcDepositFee (depositedAmount,feePerc) = {
53- let fee = ((depositedAmount * feePerc) / 10000)
54- if ((1 > fee))
55- then 1
56- else fee
57- }
58-
59-
60-func getAssetDepositFeePerc (assetIdStr) = {
61- let settingsAddress = getSettingsAddress()
62- let keyOrigin = (keyAssetToStake + assetIdStr)
63- let isSpecificFeeEnabled = getBooleanValue(settingsAddress, (keyOrigin + keySuffixEnableSpecFee))
64- if ((isSpecificFeeEnabled == true))
65- then {
66- let specificFee = getIntegerValue(settingsAddress, (keyOrigin + keySuffixSpecFee))
67- if ((specificFee > hardcoredMaximumDepositFee))
68- then hardcoredMaximumDepositFee
69- else if ((0 > specificFee))
70- then 0
71- else specificFee
72- }
73- else {
74- let defaultDepositFee = getIntegerValue(settingsAddress, keyDefaultDepositFee)
75- if ((defaultDepositFee > hardcoredMaximumDepositFee))
76- then hardcoredMaximumDepositFee
77- else if ((0 > defaultDepositFee))
78- then 0
79- else defaultDepositFee
80- }
81- }
82-
83-
84-func getIntValueOrZero (keyName) = match getInteger(this, keyName) {
85- case isInt: Int =>
86- isInt
87- case _ =>
88- 0
89-}
90-
91-
92-func getNewNonce () = {
93- let incrNonce = (getIntValueOrZero(keyNonce) + 1)
94-[parseIntValue((toString(incrNonce) + toString(height))), incrNonce]
95- }
964
975
986 @Callable(i)
99-func updateSettingsAddress (newAddress) = if ((this != i.caller))
100- then throw("Access denied")
101- else [StringEntry(keySettingsAddress, newAddress)]
102-
103-
104-
105-@Callable(i)
106-func depositAssetToStake () = if ((isSelf(i.caller) != false))
107- then throw("dApp can't act for self")
108- else if ((size(i.payments) != 1))
109- then throw("Not a valid amount of payments (require 1)")
110- else {
111- let amount = i.payments[0].amount
112- let assetIdStr = match i.payments[0].assetId {
113- case isAsset: ByteVector =>
114- toBase58String(isAsset)
115- case _ =>
116- hardcoredAssetIdForWaves
117- }
118- let keyOrigin = (keyAssetToStake + assetIdStr)
119- let settingAddress = getSettingsAddress()
120- let isEnabled = getBooleanValue(settingAddress, (keyOrigin + keySuffixIsEnabled))
121- let minimumAmount = getIntegerValue(settingAddress, (keyOrigin + keySuffixMinAmount))
122- if ((isEnabled != true))
123- then throw("Disabled")
124- else if ((minimumAmount > amount))
125- then throw("Below minimum amount")
126- else {
127- let depositFee = calcDepositFee(amount, getAssetDepositFeePerc(assetIdStr))
128- let nonce = getNewNonce()
129- let ATSContractDesc = ((((((((toString(height) + separator) + toBase58String(i.caller.bytes)) + separator) + assetIdStr) + separator) + toString(amount)) + separator) + toString(depositFee))
130- let ATSContract = Issue(keyATSContractName, ATSContractDesc, 1, 0, false, unit, nonce[0])
131- let ATSContractId = calculateAssetId(ATSContract)
132- let newStakingAmount = (getIntValueOrZero((keyStakingAmount + assetIdStr)) + amount)
133- let newIssuedAmount = (getIntValueOrZero((keyIssuedStakingContract + assetIdStr)) + 1)
134-[IntegerEntry(keyNonce, nonce[1]), IntegerEntry((keyStakingAmount + assetIdStr), newStakingAmount), IntegerEntry((keyIssuedStakingContract + assetIdStr), newIssuedAmount), ATSContract, ScriptTransfer(i.caller, ATSContract.quantity, ATSContractId)]
135- }
136- }
137-
138-
139-
140-@Callable(i)
141-func withdrawAssetToStake () = if ((isSelf(i.caller) != false))
142- then throw("dApp can't act for self")
143- else if ((size(i.payments) != 1))
144- then throw("Not a valid amount of payments (require 1)")
145- else {
146- let contractId = match i.payments[0].assetId {
147- case isBV: ByteVector =>
148- isBV
149- case _ =>
150- throw("Contract is an Asset, not Waves")
151- }
152- let contractDetails = match assetInfo(contractId) {
153- case isAsset: Asset =>
154- isAsset
155- case _ =>
156- throw("Contract should be an existing Asset")
157- }
158- if (if (if (if (if ((contractDetails.issuer != this))
159- then true
160- else (contractDetails.decimals != 0))
161- then true
162- else (contractDetails.quantity != 1))
163- then true
164- else (contractDetails.reissuable != false))
165- then true
166- else (contractDetails.name != keyATSContractName))
167- then throw("Corrupted Contract")
168- else {
169- let contractInfo = split(contractDetails.description, separator)
170- let startingBlockHeight = parseIntValue(contractInfo[0])
171- let stakerAddress = addressFromStringValue(contractInfo[1])
172- let ATSInfo = match assetInfo(fromBase58String(contractInfo[2])) {
173- case isAsset: Asset =>
174- isAsset
175- case _ =>
176- throw("ATS Contract not recognized")
177- }
178- let amountToStake = parseIntValue(contractInfo[3])
179- let feeToPay = parseIntValue(contractInfo[4])
180- let amountToReturn = (amountToStake - feeToPay)
181- if ((startingBlockHeight > height))
182- then throw("startingBlockHeight corrupted")
183- else if (if ((1 > amountToStake))
184- then true
185- else (amountToStake > ATSInfo.quantity))
186- then throw("amountToStake corrupted")
187- else if (if ((1 > feeToPay))
188- then true
189- else (feeToPay > amountToStake))
190- then throw("feeToPay corrupted")
191- else if (if ((1 > amountToReturn))
192- then true
193- else (amountToReturn > ATSInfo.quantity))
194- then throw("amountToReturn corrupted")
195- else if ((amountToReturn > assetBalance(this, ATSInfo.id)))
196- then throw("ATS balance too low")
197- else {
198- let ATSIdStr = toBase58String(ATSInfo.id)
199- let newStakingAmount = (getIntValueOrZero((keyStakingAmount + ATSIdStr)) - amountToStake)
200- let newBurnedAmount = (getIntValueOrZero((keyBurnedStakingContract + ATSIdStr)) + 1)
201- let newTreasury = (getIntValueOrZero((keyTreasury + ATSIdStr)) + feeToPay)
202-[Burn(contractId, 1), IntegerEntry((keyStakingAmount + ATSIdStr), newStakingAmount), IntegerEntry((keyBurnedStakingContract + ATSIdStr), newBurnedAmount), IntegerEntry((keyTreasury + ATSIdStr), newTreasury), ScriptTransfer(i.caller, amountToReturn, ATSInfo.id)]
203- }
204- }
205- }
7+func call () = {
8+ let asset = Issue("Asset", "", 1, 0, true, unit, 0)
9+ let assetId = calculateAssetId(asset)
10+[BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), asset, Reissue(assetId, 1, false), Burn(assetId, 1), ScriptTransfer(i.caller, 1, assetId)]
11+ }
20612
20713
20814 @Verifier(tx)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let separator = "___"
5-
6-let hardcoredMaximumDepositFee = 100
7-
8-let hardcoredDappName = "FOKOFF"
9-
10-let hardcoredAssetIdForWaves = "WAVES"
11-
12-let keyAssetToStake = (hardcoredDappName + "_AssetToStake_")
13-
14-let keyAssetsToStakeList = (hardcoredDappName + "_AssetsToStakeList")
15-
16-let keyDefaultDepositFee = (hardcoredDappName + "_DefaultDepositFee")
17-
18-let keySuffixIsEnabled = "_isEnabled"
19-
20-let keySuffixMinAmount = "_minimumAmount"
21-
22-let keySuffixAfterHeight = "_allowStakingAfterBlockHeight"
23-
24-let keySuffixBlockDelay = "_BlocksDelayAfterDepositToStake"
25-
26-let keySuffixEnableSpecFee = "_enableSpecificDepositFee"
27-
28-let keySuffixSpecFee = "_specificDepositFee"
29-
30-let keyTreasury = (hardcoredDappName + "_Treasury_")
31-
32-let keySettingsAddress = (hardcoredDappName + "_SettingsAddress")
33-
34-let keyNonce = (hardcoredDappName + "_Nonce")
35-
36-let keyStakingAmount = (hardcoredDappName + "_StakingAmount_")
37-
38-let keyIssuedStakingContract = (hardcoredDappName + "_IssuedSContract_")
39-
40-let keyBurnedStakingContract = (hardcoredDappName + "_BurnedSContract_")
41-
42-let keyATSContractName = (hardcoredDappName + "Contract1")
43-
44-func getSettingsAddress () = Address(fromBase58String(getStringValue(this, keySettingsAddress)))
45-
46-
47-func isSelf (caller) = if ((this == caller))
48- then true
49- else (caller == getSettingsAddress())
50-
51-
52-func calcDepositFee (depositedAmount,feePerc) = {
53- let fee = ((depositedAmount * feePerc) / 10000)
54- if ((1 > fee))
55- then 1
56- else fee
57- }
58-
59-
60-func getAssetDepositFeePerc (assetIdStr) = {
61- let settingsAddress = getSettingsAddress()
62- let keyOrigin = (keyAssetToStake + assetIdStr)
63- let isSpecificFeeEnabled = getBooleanValue(settingsAddress, (keyOrigin + keySuffixEnableSpecFee))
64- if ((isSpecificFeeEnabled == true))
65- then {
66- let specificFee = getIntegerValue(settingsAddress, (keyOrigin + keySuffixSpecFee))
67- if ((specificFee > hardcoredMaximumDepositFee))
68- then hardcoredMaximumDepositFee
69- else if ((0 > specificFee))
70- then 0
71- else specificFee
72- }
73- else {
74- let defaultDepositFee = getIntegerValue(settingsAddress, keyDefaultDepositFee)
75- if ((defaultDepositFee > hardcoredMaximumDepositFee))
76- then hardcoredMaximumDepositFee
77- else if ((0 > defaultDepositFee))
78- then 0
79- else defaultDepositFee
80- }
81- }
82-
83-
84-func getIntValueOrZero (keyName) = match getInteger(this, keyName) {
85- case isInt: Int =>
86- isInt
87- case _ =>
88- 0
89-}
90-
91-
92-func getNewNonce () = {
93- let incrNonce = (getIntValueOrZero(keyNonce) + 1)
94-[parseIntValue((toString(incrNonce) + toString(height))), incrNonce]
95- }
964
975
986 @Callable(i)
99-func updateSettingsAddress (newAddress) = if ((this != i.caller))
100- then throw("Access denied")
101- else [StringEntry(keySettingsAddress, newAddress)]
102-
103-
104-
105-@Callable(i)
106-func depositAssetToStake () = if ((isSelf(i.caller) != false))
107- then throw("dApp can't act for self")
108- else if ((size(i.payments) != 1))
109- then throw("Not a valid amount of payments (require 1)")
110- else {
111- let amount = i.payments[0].amount
112- let assetIdStr = match i.payments[0].assetId {
113- case isAsset: ByteVector =>
114- toBase58String(isAsset)
115- case _ =>
116- hardcoredAssetIdForWaves
117- }
118- let keyOrigin = (keyAssetToStake + assetIdStr)
119- let settingAddress = getSettingsAddress()
120- let isEnabled = getBooleanValue(settingAddress, (keyOrigin + keySuffixIsEnabled))
121- let minimumAmount = getIntegerValue(settingAddress, (keyOrigin + keySuffixMinAmount))
122- if ((isEnabled != true))
123- then throw("Disabled")
124- else if ((minimumAmount > amount))
125- then throw("Below minimum amount")
126- else {
127- let depositFee = calcDepositFee(amount, getAssetDepositFeePerc(assetIdStr))
128- let nonce = getNewNonce()
129- let ATSContractDesc = ((((((((toString(height) + separator) + toBase58String(i.caller.bytes)) + separator) + assetIdStr) + separator) + toString(amount)) + separator) + toString(depositFee))
130- let ATSContract = Issue(keyATSContractName, ATSContractDesc, 1, 0, false, unit, nonce[0])
131- let ATSContractId = calculateAssetId(ATSContract)
132- let newStakingAmount = (getIntValueOrZero((keyStakingAmount + assetIdStr)) + amount)
133- let newIssuedAmount = (getIntValueOrZero((keyIssuedStakingContract + assetIdStr)) + 1)
134-[IntegerEntry(keyNonce, nonce[1]), IntegerEntry((keyStakingAmount + assetIdStr), newStakingAmount), IntegerEntry((keyIssuedStakingContract + assetIdStr), newIssuedAmount), ATSContract, ScriptTransfer(i.caller, ATSContract.quantity, ATSContractId)]
135- }
136- }
137-
138-
139-
140-@Callable(i)
141-func withdrawAssetToStake () = if ((isSelf(i.caller) != false))
142- then throw("dApp can't act for self")
143- else if ((size(i.payments) != 1))
144- then throw("Not a valid amount of payments (require 1)")
145- else {
146- let contractId = match i.payments[0].assetId {
147- case isBV: ByteVector =>
148- isBV
149- case _ =>
150- throw("Contract is an Asset, not Waves")
151- }
152- let contractDetails = match assetInfo(contractId) {
153- case isAsset: Asset =>
154- isAsset
155- case _ =>
156- throw("Contract should be an existing Asset")
157- }
158- if (if (if (if (if ((contractDetails.issuer != this))
159- then true
160- else (contractDetails.decimals != 0))
161- then true
162- else (contractDetails.quantity != 1))
163- then true
164- else (contractDetails.reissuable != false))
165- then true
166- else (contractDetails.name != keyATSContractName))
167- then throw("Corrupted Contract")
168- else {
169- let contractInfo = split(contractDetails.description, separator)
170- let startingBlockHeight = parseIntValue(contractInfo[0])
171- let stakerAddress = addressFromStringValue(contractInfo[1])
172- let ATSInfo = match assetInfo(fromBase58String(contractInfo[2])) {
173- case isAsset: Asset =>
174- isAsset
175- case _ =>
176- throw("ATS Contract not recognized")
177- }
178- let amountToStake = parseIntValue(contractInfo[3])
179- let feeToPay = parseIntValue(contractInfo[4])
180- let amountToReturn = (amountToStake - feeToPay)
181- if ((startingBlockHeight > height))
182- then throw("startingBlockHeight corrupted")
183- else if (if ((1 > amountToStake))
184- then true
185- else (amountToStake > ATSInfo.quantity))
186- then throw("amountToStake corrupted")
187- else if (if ((1 > feeToPay))
188- then true
189- else (feeToPay > amountToStake))
190- then throw("feeToPay corrupted")
191- else if (if ((1 > amountToReturn))
192- then true
193- else (amountToReturn > ATSInfo.quantity))
194- then throw("amountToReturn corrupted")
195- else if ((amountToReturn > assetBalance(this, ATSInfo.id)))
196- then throw("ATS balance too low")
197- else {
198- let ATSIdStr = toBase58String(ATSInfo.id)
199- let newStakingAmount = (getIntValueOrZero((keyStakingAmount + ATSIdStr)) - amountToStake)
200- let newBurnedAmount = (getIntValueOrZero((keyBurnedStakingContract + ATSIdStr)) + 1)
201- let newTreasury = (getIntValueOrZero((keyTreasury + ATSIdStr)) + feeToPay)
202-[Burn(contractId, 1), IntegerEntry((keyStakingAmount + ATSIdStr), newStakingAmount), IntegerEntry((keyBurnedStakingContract + ATSIdStr), newBurnedAmount), IntegerEntry((keyTreasury + ATSIdStr), newTreasury), ScriptTransfer(i.caller, amountToReturn, ATSInfo.id)]
203- }
204- }
205- }
7+func call () = {
8+ let asset = Issue("Asset", "", 1, 0, true, unit, 0)
9+ let assetId = calculateAssetId(asset)
10+[BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), asset, Reissue(assetId, 1, false), Burn(assetId, 1), ScriptTransfer(i.caller, 1, assetId)]
11+ }
20612
20713
20814 @Verifier(tx)
20915 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
21016

github/deemru/w8io/169f3d6 
31.08 ms