tx · 8NWqnMqxqwuYUBfiu5kUMQkCpvLrEHx3AtZehYq2Z4J5

3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg:  -0.01400000 Waves

2021.04.02 16:51 [1464909] smart account 3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg > SELF 0.00000000 Waves

{ "type": 13, "id": "8NWqnMqxqwuYUBfiu5kUMQkCpvLrEHx3AtZehYq2Z4J5", "fee": 1400000, "feeAssetId": null, "timestamp": 1617371552328, "version": 2, "chainId": 84, "sender": "3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg", "senderPublicKey": "6RxCbWeRD4VWkRJtcAR8HBRkrBbEzZWucSBL6YrSFQrE", "proofs": [ "5Mi951SqS1ZeWHKPcpZ69McqK1ZU64e9yJjoMYdKUyBvH5Qxm2w8FupeLpFBjwQM93EZDK5ayeF3puq2TaLNVHx2" ], "script": "base64:AAIEAAAAAAAAAAYIAhIAEgAAAAATAAAAAA9uZXV0cmlub0Fzc2V0SWQBAAAAIG8ko8qrMNxSKZjoLGFa7lp/I03CLXW76Z2qVODS0AfBAAAAAAtuc2J0QXNzZXRJZAEAAAAgHzHKqJoXhJqJN2I09RXg46JIn0GFYur0HgDtWiIaqSQAAAAAE05ldXRyaW5vQ29udHJhY3RLZXkBAAAAGgFUuYnNz0dxupdy7LhFDzOwqkmF0Q14MgJtAAAAAAhVU0ROVFlQRQIAAAAEVVNETgAAAAAITlNCVFRZUEUCAAAABE5TQlQAAAAACkJhbGFuY2VLZXkCAAAAC3JwZF9iYWxhbmNlAQAAABFnZXRVc2VyQmFsYW5jZUtleQAAAAIAAAAFb3duZXIAAAAHYXNzZXRJZAkABLkAAAACCQAETAAAAAIFAAAACkJhbGFuY2VLZXkJAARMAAAAAgUAAAAHYXNzZXRJZAkABEwAAAACBQAAAAVvd25lcgUAAAADbmlsAgAAAAFfAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAA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NhbGxlcgAAAAAAAAAAZAAAAAFpAQAAAAhsb2NrTnNidAAAAAAJAQAAABRpbnRlcm5hbExvY2tOZXV0cmlubwAAAAQFAAAACE5TQlRUWVBFBQAAAAFpCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAZAAAAADDy1Dd", "height": 1464909, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 58zjRREcNt9CTGG6p5JLrq8AniaXRtnFGsfWyVtAt6Gz Next: BtqRat7zqcEVN4TbxMheQkMMncrG3sdEy3LnM8vnanzL Diff:
OldNewDifferences
117117 }
118118
119119
120+@Callable(i)
121+func lockNeutrino () = internalLockNeutrino(USDNTYPE, i, toString(i.caller), 100)
122+
123+
124+
125+@Callable(i)
126+func lockNsbt () = internalLockNeutrino(NSBTTYPE, i, toString(i.caller), 100)
127+
120128
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let neutrinoAssetId = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS'
55
66 let nsbtAssetId = base58'36mg8NZTaFRDygiVwb8uBnLR51hetJruUCZcxhaVcHj9'
77
88 let NeutrinoContractKey = base58'3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg'
99
1010 let USDNTYPE = "USDN"
1111
1212 let NSBTTYPE = "NSBT"
1313
1414 let BalanceKey = "rpd_balance"
1515
1616 func getUserBalanceKey (owner,assetId) = makeString([BalanceKey, assetId, owner], "_")
1717
1818
1919 func getStringByKey (key) = valueOrElse(getString(this, key), "")
2020
2121
2222 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
2323
2424
2525 func getRewardConfigInitialShare (owner) = (owner + "_initialShare")
2626
2727
2828 func getRewardsConfigKey (owner,share,receiver) = makeString(["stakingconfig", owner, toString(share), receiver], "_")
2929
3030
3131 func getUserBalance (owner,assetId) = getNumberByKey(getUserBalanceKey(owner, assetId))
3232
3333
3434 func getValidStakingAssetOrFail (stakingType,assetId) = if (if ((stakingType == USDNTYPE))
3535 then (assetId != neutrinoAssetId)
3636 else false)
3737 then throw("can use USDN only")
3838 else if (if ((stakingType == NSBTTYPE))
3939 then (assetId != nsbtAssetId)
4040 else false)
4141 then throw("can use NSBT only")
4242 else if (if ((stakingType != USDNTYPE))
4343 then (stakingType != NSBTTYPE)
4444 else false)
4545 then throw(("unsupported staking type " + stakingType))
4646 else assetId
4747
4848
4949 func getCurrentRewardsConfigKey (owner) = ("stakingconfig_current_" + owner)
5050
5151
5252 func getRewardsConfigStartKey (configKey,isStart) = (configKey + (if (isStart)
5353 then "_start"
5454 else "_end"))
5555
5656
5757 func getContractBalanceKey (assetId) = ((BalanceKey + "_") + assetId)
5858
5959
6060 func getContractBalance (assetId) = getNumberByKey(getContractBalanceKey(assetId))
6161
6262
6363 func internalUnlock (stakingType,i,unlockAmount,assetIdParam) = {
6464 let account = toString(i.caller)
6565 let assetId = getValidStakingAssetOrFail(stakingType, fromBase58String(assetIdParam))
6666 let assetIdString = toBase58String(assetId)
6767 let balance = (getUserBalance(account, assetIdString) - unlockAmount)
6868 if ((0 > balance))
6969 then throw("invalid amount")
7070 else [IntegerEntry(getContractBalanceKey(assetIdString), (getContractBalance(assetIdString) - unlockAmount)), IntegerEntry(getUserBalanceKey(account, assetIdString), balance), ScriptTransfer(addressFromStringValue(account), unlockAmount, assetId)]
7171 }
7272
7373
7474 func internalLockNeutrino (stakingType,i,receiver,share) = {
7575 let pmt = value(i.payments[0])
7676 let assetId = getValidStakingAssetOrFail(stakingType, value(pmt.assetId))
7777 if (!(isDefined(addressFromString(receiver))))
7878 then throw(("Invalid address format " + receiver))
7979 else if ((share > 100))
8080 then throw("staking rewards share cannot be higher than 100%")
8181 else if ((1 > share))
8282 then throw("staking rewards share cannot be lower than 1%")
8383 else {
8484 let account = toString(i.caller)
8585 let assetIdString = toBase58String(assetId)
8686 let currentConfig = getStringByKey(getCurrentRewardsConfigKey(account))
8787 let correctData = if ((currentConfig != ""))
8888 then {
8989 let currentConfigData = split(currentConfig, "_")
9090 let currShare = parseIntValue(currentConfigData[2])
9191 let currReceiver = currentConfigData[3]
9292 let notMigratedInitialShare = getNumberByKey(getRewardConfigInitialShare(account))
9393 let actualInitialShare = if ((notMigratedInitialShare == 0))
9494 then currShare
9595 else notMigratedInitialShare
9696 let newShare = if (if ((actualInitialShare > share))
9797 then true
9898 else (currReceiver != receiver))
9999 then actualInitialShare
100100 else share
101101 [toString(actualInitialShare), toString(newShare), currReceiver]
102102 }
103103 else [toString(share), toString(share), receiver]
104104 let correctInitialShare = parseIntValue(correctData[0])
105105 let correctShare = parseIntValue(correctData[1])
106106 let correctReceiver = correctData[2]
107107 let newCurrentConfig = getRewardsConfigKey(account, correctShare, correctReceiver)
108108 let isNewConfig = !((currentConfig == newCurrentConfig))
109109 let end = if (isNewConfig)
110110 then height
111111 else 0
112112 let start = if (isNewConfig)
113113 then height
114114 else getNumberByKey(getRewardsConfigStartKey(newCurrentConfig, true))
115115 [IntegerEntry(getContractBalanceKey(assetIdString), (getContractBalance(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)]
116116 }
117117 }
118118
119119
120+@Callable(i)
121+func lockNeutrino () = internalLockNeutrino(USDNTYPE, i, toString(i.caller), 100)
122+
123+
124+
125+@Callable(i)
126+func lockNsbt () = internalLockNeutrino(NSBTTYPE, i, toString(i.caller), 100)
127+
120128

github/deemru/w8io/026f985 
30.43 ms