tx · Fmb2N7vrr8LSKUmSbPFvVfAZ9MiqHG45nvgAppmWZ88w

3MxnfLmkQdmBHFpvMrtUBZ6oU1BnTHt7wCk:  -0.01400000 Waves

2020.09.23 11:00 [1189682] smart account 3MxnfLmkQdmBHFpvMrtUBZ6oU1BnTHt7wCk > SELF 0.00000000 Waves

{ "type": 13, "id": "Fmb2N7vrr8LSKUmSbPFvVfAZ9MiqHG45nvgAppmWZ88w", "fee": 1400000, "feeAssetId": null, "timestamp": 1600848008068, "version": 2, "chainId": 84, "sender": "3MxnfLmkQdmBHFpvMrtUBZ6oU1BnTHt7wCk", "senderPublicKey": "55rB1q3MKx9sFwZpomq8X1LrY9sSqqHu1uDFDEhhHSWe", "proofs": [ "5i99n8jNtGidYnByErw5mprxvBQzscB5rcR7aA4GKsq1QbDS4bTN6soKnBRXo6cMt92zHQ3ksgA5TodXtXCpYvc4" ], "script": "base64:AAIEAAAAAAAAABAIAhIECgIIARIAEgQKAgEIAAAAFwEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AgAAAAABAAAADGdldEJvb2xCeUtleQAAAAEAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAAAACCQAEGwAAAAIFAAAABHRoaXMFAAAAA2tleQcBAAAAGGdldE51bWJlckJ5QWRkcmVzc0FuZEtleQAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAAHYWRkcmVzcwUAAAADa2V5AAAAAAAAAAAAAQAAABhnZXRTdHJpbmdCeUFkZHJlc3NBbmRLZXkAAA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QAAAAEFAAAADWFzc2V0SWRTdHJpbmcFAAAADHVubG9ja0Ftb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAAEWdldFVzZXJCYWxhbmNlS2V5AAAAAgUAAAAHYWNjb3VudAUAAAANYXNzZXRJZFN0cmluZwUAAAAHYmFsYW5jZQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAdhY2NvdW50BQAAAAx1bmxvY2tBbW91bnQFAAAAB2Fzc2V0SWQFAAAAA25pbAAAAAARPBoe", "height": 1189682, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DBVc3UGRuiuA1fS9S9QzoJ1JdZEySDWEUg9NWbVzg9tk Next: GwLnU9cSwxpyjWpEedoZVuBTz8bk1fL6eej92kBQqWzK Diff:
OldNewDifferences
2828 func getUserBalanceKey (owner,assetId) = (((((("%s%s%s" + separator) + "stakingBalance") + separator) + assetId) + separator) + owner)
2929
3030
31-func getAssetConfigKey (assetAddress) = (((("%s%s" + separator) + "defoAsset") + separator) + assetAddress)
31+func getAssetConfigKey (assetAddress) = ((((("%s%s%s" + separator) + "defoAsset") + separator) + assetAddress) + "__config")
3232
3333
3434 func getRewardsConfigKey (owner,share,receiver) = (((((((("%s%s%s%s" + separator) + "stakingConfig") + separator) + owner) + separator) + toString(share)) + separator) + receiver)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
55
66
77 func getStringByKey (key) = valueOrElse(getString(this, key), "")
88
99
1010 func getBoolByKey (key) = valueOrElse(getBoolean(this, key), false)
1111
1212
1313 func getNumberByAddressAndKey (address,key) = valueOrElse(getInteger(addressFromStringValue(address), key), 0)
1414
1515
1616 func getStringByAddressAndKey (address,key) = valueOrElse(getString(address, key), "")
1717
1818
1919 let separator = "__"
2020
2121 let factoryContractAddressKey = (("%s" + separator) + "factory")
2222
2323 let keyAssetStatus = 3
2424
2525 func getStakingAssetBalanceKey (assetId) = (((("%s%s" + separator) + "stakingBalance") + separator) + assetId)
2626
2727
2828 func getUserBalanceKey (owner,assetId) = (((((("%s%s%s" + separator) + "stakingBalance") + separator) + assetId) + separator) + owner)
2929
3030
31-func getAssetConfigKey (assetAddress) = (((("%s%s" + separator) + "defoAsset") + separator) + assetAddress)
31+func getAssetConfigKey (assetAddress) = ((((("%s%s%s" + separator) + "defoAsset") + separator) + assetAddress) + "__config")
3232
3333
3434 func getRewardsConfigKey (owner,share,receiver) = (((((((("%s%s%s%s" + separator) + "stakingConfig") + separator) + owner) + separator) + toString(share)) + separator) + receiver)
3535
3636
3737 func getCurrentRewardsConfigKey (owner) = (((("%s%s" + separator) + "stakingConfigCurrent") + separator) + owner)
3838
3939
4040 func getRewardsConfigStartKey (configKey,isStart) = (configKey + (if (isStart)
4141 then (separator + "start")
4242 else (separator + "end")))
4343
4444
4545 func getRewardConfigInitialShare (owner) = (((("%s%s" + separator) + owner) + separator) + "initialShare")
4646
4747
4848 func getAssetAddressByAssetIdKey (assetId) = (((((("%s%s%s" + separator) + "defoAssetId") + separator) + assetId) + separator) + "contract")
4949
5050
5151 func convertJsonArrayToList (jsonArray,splitSymbol) = split(jsonArray, splitSymbol)
5252
5353
5454 let factoryContract = addressFromStringValue(valueOrErrorMessage(getString(this, factoryContractAddressKey), "No factory contract specified."))
5555
5656 func getUserBalance (owner,assetId) = getNumberByKey(getUserBalanceKey(owner, assetId))
5757
5858
5959 func getStakingAssetBalance (assetId) = getNumberByKey(getStakingAssetBalanceKey(assetId))
6060
6161
6262 func getSyntheticContractByAssetId (assetId) = getString(factoryContract, getAssetAddressByAssetIdKey(assetId))
6363
6464
6565 func getAssetConfigArray (assetAddress) = convertJsonArrayToList(valueOrErrorMessage(getStringByAddressAndKey(factoryContract, getAssetConfigKey(assetAddress)), (("No DEFO Asset " + assetAddress) + "config present")), separator)
6666
6767
6868 func internallock (i,receiver,share) = {
6969 let pmt = valueOrErrorMessage(i.payments[0], "No asset pased in payment.")
7070 let assetIdString = toBase58String(value(pmt.assetId))
7171 let syntheticAssetContract = valueOrErrorMessage(getSyntheticContractByAssetId(assetIdString), "Passed payment asset is not valid.")
7272 let syntheticAssetConfig = getAssetConfigArray(syntheticAssetContract)
7373 if (!(isDefined(addressFromString(receiver))))
7474 then throw(("Invalid address format " + receiver))
7575 else if ((share > 100))
7676 then throw("staking rewards share cannot be higher than 100%")
7777 else if ((1 > share))
7878 then throw("staking rewards share cannot be lower than 1%")
7979 else if ((syntheticAssetConfig[keyAssetStatus] != "ISSUED"))
8080 then throw("Synthetic asset should be with ISSUED status")
8181 else {
8282 let account = toString(i.caller)
8383 let currentConfig = getStringByKey(getCurrentRewardsConfigKey(account))
8484 let correctData = if ((currentConfig != ""))
8585 then {
8686 let currentConfigData = split(currentConfig, separator)
8787 let currShare = parseIntValue(currentConfigData[3])
8888 let currReceiver = currentConfigData[4]
8989 let notMigratedInitialShare = getNumberByKey(getRewardConfigInitialShare(account))
9090 let actualInitialShare = if ((notMigratedInitialShare == 0))
9191 then currShare
9292 else notMigratedInitialShare
9393 let newShare = if (if ((actualInitialShare > share))
9494 then true
9595 else (currReceiver != receiver))
9696 then actualInitialShare
9797 else share
9898 [toString(actualInitialShare), toString(newShare), currReceiver]
9999 }
100100 else [toString(share), toString(share), receiver]
101101 let correctInitialShare = parseIntValue(correctData[0])
102102 let correctShare = parseIntValue(correctData[1])
103103 let correctReceiver = correctData[2]
104104 let newCurrentConfig = getRewardsConfigKey(account, correctShare, correctReceiver)
105105 let isNewConfig = !((currentConfig == newCurrentConfig))
106106 let end = if (isNewConfig)
107107 then height
108108 else 0
109109 let start = if (isNewConfig)
110110 then height
111111 else getNumberByKey(getRewardsConfigStartKey(newCurrentConfig, true))
112112 [IntegerEntry(getStakingAssetBalanceKey(assetIdString), (getStakingAssetBalance(assetIdString) + pmt.amount)), IntegerEntry(getUserBalanceKey(account, assetIdString), (getUserBalance(account, assetIdString) + pmt.amount)), IntegerEntry(getRewardsConfigStartKey(currentConfig, false), end), IntegerEntry(getRewardsConfigStartKey(newCurrentConfig, true), start), IntegerEntry(getRewardConfigInitialShare(account), correctInitialShare), StringEntry(getCurrentRewardsConfigKey(account), newCurrentConfig)]
113113 }
114114 }
115115
116116
117117 @Callable(i)
118118 func startStakingSP (receiver,share) = internallock(i, receiver, share)
119119
120120
121121
122122 @Callable(i)
123123 func startStaking () = internallock(i, toString(i.caller), 100)
124124
125125
126126
127127 @Callable(i)
128128 func stopStaking (unlockAmount,assetIdString) = {
129129 let account = toString(i.caller)
130130 let assetId = fromBase58String(assetIdString)
131131 let syntheticAssetContract = valueOrErrorMessage(getSyntheticContractByAssetId(assetIdString), "Passed payment asset is not valid.")
132132 let syntheticAssetConfig = getAssetConfigArray(syntheticAssetContract)
133133 let balance = (getUserBalance(account, assetIdString) - unlockAmount)
134134 if ((0 > balance))
135135 then throw("invalid amount")
136136 else if ((syntheticAssetConfig[keyAssetStatus] != "ISSUED"))
137137 then throw("Synthetic asset should be with ISSUED status")
138138 else [IntegerEntry(getStakingAssetBalanceKey(assetIdString), (getStakingAssetBalance(assetIdString) - unlockAmount)), IntegerEntry(getUserBalanceKey(account, assetIdString), balance), ScriptTransfer(addressFromStringValue(account), unlockAmount, assetId)]
139139 }
140140
141141

github/deemru/w8io/026f985 
29.49 ms