tx · BNSyRHt8ofhRCxxaw9MzC5iPu7D7LQxQ2xDyg5ZDFZtX 3MuQhHwWBaS3HuGgBPoCDLKFnDyAZAtUVhC: -0.01400000 Waves 2019.11.15 14:44 [766152] smart account 3MuQhHwWBaS3HuGgBPoCDLKFnDyAZAtUVhC > SELF 0.00000000 Waves
{ "type": 13, "id": "BNSyRHt8ofhRCxxaw9MzC5iPu7D7LQxQ2xDyg5ZDFZtX", "fee": 1400000, "feeAssetId": null, "timestamp": 1573818294877, "version": 1, "sender": "3MuQhHwWBaS3HuGgBPoCDLKFnDyAZAtUVhC", "senderPublicKey": "NHFZfPCHxou7ydDCZ9s7n8wBcyJPywMRZoeSFhM4Rdu", "proofs": [ "3iFcy2yAgzvtn9f99qA2QkPoL7JH9HLSXUmSufnBApz3iGoZZCcuZFVdwrfKnXRxPXGxgCc1ZQPZtGSvsRH2CcyY" ], "script": "base64:AAIDAAAAAAAAABAIARIAEgQKAgEIEgQKAgEBAAAAIwEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAAAxnZXRCb29sQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBsAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAB0Jvb2xlYW4EAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEHAQAAABhnZXROdW1iZXJCeUFkZHJlc3NBbmRLZXkAAAACAA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AxzaGFyZVBlcmNlbnQJAQAAAAlnZXRQcm9maXQAAAABBQAAAA9wcm9maXRTeW5jSW5kZXgFAAAAD1BFUkNFTlRBQ0NVUkFDWQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAA9nZXRJc0NsYWltZWRLZXkAAAACBQAAAAdhY2NvdW50BQAAAA9wcm9maXRTeW5jSW5kZXgGBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAAdhY2NvdW50BQAAAAZwcm9maXQFAAAAD25ldXRyaW5vQXNzZXRJZAUAAAADbmlsAAAAAKVHJrc=", "chainId": 84, "height": 766152, "spentComplexity": 0 } View: original | compacted Prev: 4jqRAPoTQNFMiUaBEXKWYDdFEjaNnDM1matePu2ngT4B Next: 9UuNEHfgFoFkv53hFwQ1snENvXLLPFEEEhTQnxzyPyEq Diff:
Old | New | Differences | |
---|---|---|---|
45 | 45 | ||
46 | 46 | let PERCENTACCURACY = 10000 | |
47 | 47 | ||
48 | - | let | |
48 | + | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
49 | 49 | ||
50 | 50 | let NeutrinoContractKey = "neutrino_contract" | |
51 | 51 | ||
86 | 86 | ||
87 | 87 | let neutrinoContract = getStringByKey(NeutrinoContractKey) | |
88 | 88 | ||
89 | - | let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, | |
89 | + | let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, NeutrinoAssetIdKey)) | |
90 | 90 | ||
91 | 91 | let syncIndex = getNumberByAddressAndKey(neutrinoContract, SyncIndexKey) | |
92 | - | ||
93 | - | func getContractBalance (assetId) = getNumberByKey(getContractBalanceKey(assetId)) | |
94 | - | ||
95 | 92 | ||
96 | 93 | func getSnapshotContractBalance (count,assetId) = getNumberByAddressAndKey(neutrinoContract, getSnapshotContractBalanceKey(count, assetId)) | |
97 | 94 | ||
98 | 95 | ||
99 | 96 | func getProfit (count) = getNumberByAddressAndKey(neutrinoContract, getProfitKey(count)) | |
97 | + | ||
98 | + | ||
99 | + | func getContractBalance (assetId) = getNumberByKey(getContractBalanceKey(assetId)) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func getUserBalance (owner,assetId) = getNumberByKey(getUserBalanceKey(owner, assetId)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getNumberByKey (key) = match getInteger(this, key) { | |
5 | 5 | case a: Int => | |
6 | 6 | a | |
7 | 7 | case _ => | |
8 | 8 | 0 | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getStringByKey (key) = match getString(this, key) { | |
13 | 13 | case a: String => | |
14 | 14 | a | |
15 | 15 | case _ => | |
16 | 16 | "" | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getBoolByKey (key) = match getBoolean(this, key) { | |
21 | 21 | case a: Boolean => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | false | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getNumberByAddressAndKey (address,key) = match getInteger(addressFromStringValue(address), key) { | |
29 | 29 | case a: Int => | |
30 | 30 | a | |
31 | 31 | case _ => | |
32 | 32 | 0 | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getStringByAddressAndKey (address,key) = match getString(addressFromStringValue(address), key) { | |
37 | 37 | case a: String => | |
38 | 38 | a | |
39 | 39 | case _ => | |
40 | 40 | "" | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | let LISTSPLITSYMBOL = "_" | |
45 | 45 | ||
46 | 46 | let PERCENTACCURACY = 10000 | |
47 | 47 | ||
48 | - | let | |
48 | + | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
49 | 49 | ||
50 | 50 | let NeutrinoContractKey = "neutrino_contract" | |
51 | 51 | ||
52 | 52 | let NodeAddressKey = "node_address" | |
53 | 53 | ||
54 | 54 | let BalanceKey = "rpd_balance" | |
55 | 55 | ||
56 | 56 | let SyncIndexKey = "rpd_sync_index" | |
57 | 57 | ||
58 | 58 | let ProfitKey = "rpd_profit" | |
59 | 59 | ||
60 | 60 | let BalanceHistoryKey = "balance_history" | |
61 | 61 | ||
62 | 62 | let IsClaimedKey = "is_claimed" | |
63 | 63 | ||
64 | 64 | func getUserBalanceHistoryKey (owner) = ((BalanceHistoryKey + "_") + owner) | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func getUserBalanceKey (owner,assetId) = ((((BalanceKey + "_") + assetId) + "_") + owner) | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func getUserBalanceKeyByCount (owner,count,assetId) = ((getUserBalanceKey(owner, assetId) + "_") + toString(count)) | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func getIsClaimedKey (owner,count) = ((((IsClaimedKey + "_") + owner) + "_") + toString(count)) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func getContractBalanceKey (assetId) = ((BalanceKey + "_") + assetId) | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func getSnapshotContractBalanceKey (count,assetId) = ((((BalanceKey + "_") + assetId) + "_") + toString(count)) | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func getProfitKey (count) = ((ProfitKey + "_") + toString(count)) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | let nodeAddress = getStringByKey(NodeAddressKey) | |
86 | 86 | ||
87 | 87 | let neutrinoContract = getStringByKey(NeutrinoContractKey) | |
88 | 88 | ||
89 | - | let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, | |
89 | + | let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, NeutrinoAssetIdKey)) | |
90 | 90 | ||
91 | 91 | let syncIndex = getNumberByAddressAndKey(neutrinoContract, SyncIndexKey) | |
92 | - | ||
93 | - | func getContractBalance (assetId) = getNumberByKey(getContractBalanceKey(assetId)) | |
94 | - | ||
95 | 92 | ||
96 | 93 | func getSnapshotContractBalance (count,assetId) = getNumberByAddressAndKey(neutrinoContract, getSnapshotContractBalanceKey(count, assetId)) | |
97 | 94 | ||
98 | 95 | ||
99 | 96 | func getProfit (count) = getNumberByAddressAndKey(neutrinoContract, getProfitKey(count)) | |
97 | + | ||
98 | + | ||
99 | + | func getContractBalance (assetId) = getNumberByKey(getContractBalanceKey(assetId)) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func getUserBalance (owner,assetId) = getNumberByKey(getUserBalanceKey(owner, assetId)) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func getUserBalanceByCount (owner,count,assetId) = getNumberByKey(getUserBalanceKeyByCount(owner, count, assetId)) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getUserBalanceHistory (owner) = getStringByKey(getUserBalanceHistoryKey(owner)) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func isClaimed (owner,count) = getBoolByKey(getIsClaimedKey(owner, count)) | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func getHistoryElement (count) = (toString(count) + LISTSPLITSYMBOL) | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func addBalanceHistory (history,element) = (history + element) | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | @Callable(i) | |
121 | 121 | func lockNeutrino () = { | |
122 | 122 | let pmt = extract(i.payment) | |
123 | 123 | if ((pmt.assetId != neutrinoAssetId)) | |
124 | 124 | then throw("can use neutrino") | |
125 | 125 | else { | |
126 | 126 | let account = toString(i.caller) | |
127 | 127 | let assetIdString = toBase58String(value(pmt.assetId)) | |
128 | 128 | let balance = (getUserBalance(account, assetIdString) + pmt.amount) | |
129 | 129 | let historyString = getUserBalanceHistory(account) | |
130 | 130 | let history = split(historyString, LISTSPLITSYMBOL) | |
131 | 131 | let index = (size(history) - 2) | |
132 | 132 | let newHistory = if (if ((historyString != "")) | |
133 | 133 | then (parseIntValue(history[index]) == syncIndex) | |
134 | 134 | else false) | |
135 | 135 | then historyString | |
136 | 136 | else addBalanceHistory(historyString, getHistoryElement(syncIndex)) | |
137 | 137 | WriteSet([DataEntry(getContractBalanceKey(assetIdString), (getContractBalance(assetIdString) + pmt.amount)), DataEntry(getUserBalanceKey(account, assetIdString), balance), DataEntry(getUserBalanceKeyByCount(account, syncIndex, assetIdString), balance), DataEntry(getUserBalanceHistoryKey(account), newHistory)]) | |
138 | 138 | } | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | ||
143 | 143 | @Callable(i) | |
144 | 144 | func unlockNeutrino (unlockAmount,assetIdString) = { | |
145 | 145 | let account = toString(i.caller) | |
146 | 146 | let assetId = fromBase58String(assetIdString) | |
147 | 147 | let balance = (getUserBalance(account, assetIdString) - unlockAmount) | |
148 | 148 | if ((0 > balance)) | |
149 | 149 | then throw("invalid amount") | |
150 | 150 | else if ((assetId != neutrinoAssetId)) | |
151 | 151 | then throw("can use neutrino") | |
152 | 152 | else { | |
153 | 153 | let historyString = getUserBalanceHistory(account) | |
154 | 154 | let history = split(historyString, LISTSPLITSYMBOL) | |
155 | 155 | let index = (size(history) - 2) | |
156 | 156 | let newHistory = if (if ((historyString != "")) | |
157 | 157 | then (parseIntValue(history[index]) == syncIndex) | |
158 | 158 | else false) | |
159 | 159 | then historyString | |
160 | 160 | else addBalanceHistory(historyString, getHistoryElement(syncIndex)) | |
161 | 161 | ScriptResult(WriteSet([DataEntry(getContractBalanceKey(assetIdString), (getContractBalance(assetIdString) - unlockAmount)), DataEntry(getUserBalanceKey(account, assetIdString), balance), DataEntry(getUserBalanceKeyByCount(account, syncIndex, assetIdString), balance), DataEntry(getUserBalanceHistoryKey(account), newHistory)]), TransferSet([ScriptTransfer(addressFromStringValue(account), unlockAmount, neutrinoAssetId)])) | |
162 | 162 | } | |
163 | 163 | } | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | ||
167 | 167 | @Callable(i) | |
168 | 168 | func withdraw (profitSyncIndex,historyIndex) = { | |
169 | 169 | let account = toString(i.caller) | |
170 | 170 | let historyString = getUserBalanceHistory(account) | |
171 | 171 | let history = split(historyString, LISTSPLITSYMBOL) | |
172 | 172 | let lockActual = parseIntValue(history[historyIndex]) | |
173 | 173 | if (isClaimed(account, profitSyncIndex)) | |
174 | 174 | then throw(("account is claimed rpd_count:" + toString(profitSyncIndex))) | |
175 | 175 | else if (if ((lockActual > profitSyncIndex)) | |
176 | 176 | then true | |
177 | 177 | else if ((size(history) > (historyIndex + 2))) | |
178 | 178 | then (profitSyncIndex >= parseIntValue(history[(historyIndex + 1)])) | |
179 | 179 | else false) | |
180 | 180 | then throw("invalid history index") | |
181 | 181 | else { | |
182 | 182 | let neutrinoAssetIdString = toBase58String(neutrinoAssetId) | |
183 | 183 | let balance = getUserBalanceByCount(account, lockActual, neutrinoAssetIdString) | |
184 | 184 | let sharePercent = ((balance * PERCENTACCURACY) / getSnapshotContractBalance(profitSyncIndex, neutrinoAssetIdString)) | |
185 | 185 | let profit = ((sharePercent * getProfit(profitSyncIndex)) / PERCENTACCURACY) | |
186 | 186 | ScriptResult(WriteSet([DataEntry(getIsClaimedKey(account, profitSyncIndex), true)]), TransferSet([ScriptTransfer(addressFromStringValue(account), profit, neutrinoAssetId)])) | |
187 | 187 | } | |
188 | 188 | } | |
189 | 189 | ||
190 | 190 |
github/deemru/w8io/169f3d6 51.70 ms ◑