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/I03CLXW76Z2qVODS0AfBAAAAAAtuc2J0QXNzZXRJZAEAAAAgHzHKqJoXhJqJN2I09RXg46JIn0GFYur0HgDtWiIaqSQAAAAAE05ldXRyaW5vQ29udHJhY3RLZXkBAAAAGgFUuYnNz0dxupdy7LhFDzOwqkmF0Q14MgJtAAAAAAhVU0ROVFlQRQIAAAAEVVNETgAAAAAITlNCVFRZUEUCAAAABE5TQlQAAAAACkJhbGFuY2VLZXkCAAAAC3JwZF9iYWxhbmNlAQAAABFnZXRVc2VyQmFsYW5jZUtleQAAAAIAAAAFb3duZXIAAAAHYXNzZXRJZAkABLkAAAACCQAETAAAAAIFAAAACkJhbGFuY2VLZXkJAARMAAAAAgUAAAAHYXNzZXRJZAkABEwAAAACBQAAAAVvd25lcgUAAAADbmlsAgAAAAFfAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAAA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hbGxlcgAAAAAAAAAAZAAAAAFpAQAAAAhsb2NrTnNidAAAAAAJAQAAABRpbnRlcm5hbExvY2tOZXV0cmlubwAAAAQFAAAACE5TQlRUWVBFBQAAAAFpCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAZAAAAADDy1Dd", "height": 1464909, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 58zjRREcNt9CTGG6p5JLrq8AniaXRtnFGsfWyVtAt6Gz Next: BtqRat7zqcEVN4TbxMheQkMMncrG3sdEy3LnM8vnanzL Diff:
Old | New | Differences | |
---|---|---|---|
117 | 117 | } | |
118 | 118 | ||
119 | 119 | ||
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 | + | ||
120 | 128 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let neutrinoAssetId = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
5 | 5 | ||
6 | 6 | let nsbtAssetId = base58'36mg8NZTaFRDygiVwb8uBnLR51hetJruUCZcxhaVcHj9' | |
7 | 7 | ||
8 | 8 | let NeutrinoContractKey = base58'3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg' | |
9 | 9 | ||
10 | 10 | let USDNTYPE = "USDN" | |
11 | 11 | ||
12 | 12 | let NSBTTYPE = "NSBT" | |
13 | 13 | ||
14 | 14 | let BalanceKey = "rpd_balance" | |
15 | 15 | ||
16 | 16 | func getUserBalanceKey (owner,assetId) = makeString([BalanceKey, assetId, owner], "_") | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func getRewardConfigInitialShare (owner) = (owner + "_initialShare") | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getRewardsConfigKey (owner,share,receiver) = makeString(["stakingconfig", owner, toString(share), receiver], "_") | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func getUserBalance (owner,assetId) = getNumberByKey(getUserBalanceKey(owner, assetId)) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getValidStakingAssetOrFail (stakingType,assetId) = if (if ((stakingType == USDNTYPE)) | |
35 | 35 | then (assetId != neutrinoAssetId) | |
36 | 36 | else false) | |
37 | 37 | then throw("can use USDN only") | |
38 | 38 | else if (if ((stakingType == NSBTTYPE)) | |
39 | 39 | then (assetId != nsbtAssetId) | |
40 | 40 | else false) | |
41 | 41 | then throw("can use NSBT only") | |
42 | 42 | else if (if ((stakingType != USDNTYPE)) | |
43 | 43 | then (stakingType != NSBTTYPE) | |
44 | 44 | else false) | |
45 | 45 | then throw(("unsupported staking type " + stakingType)) | |
46 | 46 | else assetId | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getCurrentRewardsConfigKey (owner) = ("stakingconfig_current_" + owner) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func getRewardsConfigStartKey (configKey,isStart) = (configKey + (if (isStart) | |
53 | 53 | then "_start" | |
54 | 54 | else "_end")) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func getContractBalanceKey (assetId) = ((BalanceKey + "_") + assetId) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func getContractBalance (assetId) = getNumberByKey(getContractBalanceKey(assetId)) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func internalUnlock (stakingType,i,unlockAmount,assetIdParam) = { | |
64 | 64 | let account = toString(i.caller) | |
65 | 65 | let assetId = getValidStakingAssetOrFail(stakingType, fromBase58String(assetIdParam)) | |
66 | 66 | let assetIdString = toBase58String(assetId) | |
67 | 67 | let balance = (getUserBalance(account, assetIdString) - unlockAmount) | |
68 | 68 | if ((0 > balance)) | |
69 | 69 | then throw("invalid amount") | |
70 | 70 | else [IntegerEntry(getContractBalanceKey(assetIdString), (getContractBalance(assetIdString) - unlockAmount)), IntegerEntry(getUserBalanceKey(account, assetIdString), balance), ScriptTransfer(addressFromStringValue(account), unlockAmount, assetId)] | |
71 | 71 | } | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func internalLockNeutrino (stakingType,i,receiver,share) = { | |
75 | 75 | let pmt = value(i.payments[0]) | |
76 | 76 | let assetId = getValidStakingAssetOrFail(stakingType, value(pmt.assetId)) | |
77 | 77 | if (!(isDefined(addressFromString(receiver)))) | |
78 | 78 | then throw(("Invalid address format " + receiver)) | |
79 | 79 | else if ((share > 100)) | |
80 | 80 | then throw("staking rewards share cannot be higher than 100%") | |
81 | 81 | else if ((1 > share)) | |
82 | 82 | then throw("staking rewards share cannot be lower than 1%") | |
83 | 83 | else { | |
84 | 84 | let account = toString(i.caller) | |
85 | 85 | let assetIdString = toBase58String(assetId) | |
86 | 86 | let currentConfig = getStringByKey(getCurrentRewardsConfigKey(account)) | |
87 | 87 | let correctData = if ((currentConfig != "")) | |
88 | 88 | then { | |
89 | 89 | let currentConfigData = split(currentConfig, "_") | |
90 | 90 | let currShare = parseIntValue(currentConfigData[2]) | |
91 | 91 | let currReceiver = currentConfigData[3] | |
92 | 92 | let notMigratedInitialShare = getNumberByKey(getRewardConfigInitialShare(account)) | |
93 | 93 | let actualInitialShare = if ((notMigratedInitialShare == 0)) | |
94 | 94 | then currShare | |
95 | 95 | else notMigratedInitialShare | |
96 | 96 | let newShare = if (if ((actualInitialShare > share)) | |
97 | 97 | then true | |
98 | 98 | else (currReceiver != receiver)) | |
99 | 99 | then actualInitialShare | |
100 | 100 | else share | |
101 | 101 | [toString(actualInitialShare), toString(newShare), currReceiver] | |
102 | 102 | } | |
103 | 103 | else [toString(share), toString(share), receiver] | |
104 | 104 | let correctInitialShare = parseIntValue(correctData[0]) | |
105 | 105 | let correctShare = parseIntValue(correctData[1]) | |
106 | 106 | let correctReceiver = correctData[2] | |
107 | 107 | let newCurrentConfig = getRewardsConfigKey(account, correctShare, correctReceiver) | |
108 | 108 | let isNewConfig = !((currentConfig == newCurrentConfig)) | |
109 | 109 | let end = if (isNewConfig) | |
110 | 110 | then height | |
111 | 111 | else 0 | |
112 | 112 | let start = if (isNewConfig) | |
113 | 113 | then height | |
114 | 114 | else getNumberByKey(getRewardsConfigStartKey(newCurrentConfig, true)) | |
115 | 115 | [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)] | |
116 | 116 | } | |
117 | 117 | } | |
118 | 118 | ||
119 | 119 | ||
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 | + | ||
120 | 128 |
github/deemru/w8io/026f985 24.37 ms ◑