tx · 36569vB25gWNF8iX8UV3DSLYTLCoET3kLshoGv8c1tq7

3MuADE2ryaHKiVHXg5uFLyB4NYnvQJLZBUv:  -0.01400000 Waves

2019.12.25 12:45 [824365] smart account 3MuADE2ryaHKiVHXg5uFLyB4NYnvQJLZBUv > SELF 0.00000000 Waves

{ "type": 13, "id": "36569vB25gWNF8iX8UV3DSLYTLCoET3kLshoGv8c1tq7", "fee": 1400000, "feeAssetId": null, "timestamp": 1577267204585, "version": 1, "sender": "3MuADE2ryaHKiVHXg5uFLyB4NYnvQJLZBUv", "senderPublicKey": "A4bJfnBhBTVh7GRNr1hHz6iqJta6eBbaExPDG7UapoaD", "proofs": [ "CWhJQBs4vgBfiLrVFXx4ynXHCaMWBLEacPM5goMwM2anhnck4cVo6A5hN4BPiZcyDM8F3aGt5xGGLUbT9hDCBYf" ], "script": "base64:AAIDAAAAAAAAABMIARIICgYIAQEBAQESABIDCgEIAAAAGQAAAAAHd2F2ZWxldAAAAAAABfXhAAAAAAAPd2F2ZXNEZXBvc2l0QW10CQAAaAAAAAIAAAAAAAAACigFAAAAB3dhdmVsZXQAAAAADWJ0Y0RlcG9zaXRBbXQJAABpAAAAAgkAAGgAAAACAAAAAAAAAAooBQAAAAd3YXZlbGV0AAAAAAAAACcQAAAAAA1ldGhEZXBvc2l0QW10CQAAaAAAAAIAAAAAAAAAAA0FAAAAB3dhdmVsZXQAAAAADWx0Y0RlcG9zaXRBbXQJAABoAAAAAgAAAAAAAAAAJwUAAAAHd2F2ZWxldAAAAAAOd2VzdERlcG9zaXRBbXQJAABoAAAAAgAAAAAAAABlkAUAAAAHd2F2ZWxldAAAAAANd2N0RGVwb3NpdEFtdAkAAGgAAAACAAAAAAAAAGWQBQAAAAd3YXZlbGV0AAAAABJEcmFnb25GcnVpdEFkZHJlc3MCAAAAIzNNekRHOXJ0MTNFdTV1dzRtWnFrRzVheERpaWp2VlNEYmpjAAAAAA1kaXZQcm9ncmFtUHViCQACWQAAAAECAAAALEE0Ykpmbk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ZQQAAAASZGl2aWRlbmRzV2l0aGRyYXduCQEAAAAbZ2V0RGl2aWRlbmRzV2l0aGRyYXduQW1vdW50AAAAAQUAAAAJYXNzZXROYW1lBAAAAAlkaXZpZGVuZHMJAQAAABJnZXREaXZpZGVuZEJhbGFuY2UAAAADCAUAAAADdHR4AAAAB2Fzc2V0SWQFAAAAEmRpdmlkZW5kc1dpdGhkcmF3bgUAAAAQZGl2aWRlbmRzUGVyY2VudAQAAAAOYWNjb3VudEJhbGFuY2UJAAPrAAAAAgUAAAAEdGhpcwgFAAAAA3R0eAAAAAdhc3NldElkCQAAZwAAAAIJAABlAAAAAgUAAAAOYWNjb3VudEJhbGFuY2UIBQAAAAN0dHgAAAAGYW1vdW50BQAAAAlkaXZpZGVuZHMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBAAAAANpdHgFAAAAByRtYXRjaDAGBwcF2dR9", "chainId": 84, "height": 824365, "spentComplexity": 0 } View: original | compacted Prev: DwaGfQqDhed3uj4fRCekMjgqypBLwjWCevY9RPG6uQGV Next: 6NwR2aJdVYwbQk78DbZgfvAbr8DUXakA8pJZkX5dLPBm Diff:
OldNewDifferences
116116
117117
118118 func getDividendsWithdrawnAmount (assetName) = {
119- let val = getInteger(this, (assetName + "_DividendsWithdrawn"))
119+ let val = getInteger(this, (assetName + "_DividendWithdrawn"))
120120 match val {
121121 case a: Int =>
122122 a
152152 let amount = amountCheck(assetName, pmt.amount)
153153 let depositState = getString(this, (assetName + "_DepositState"))
154154 if ((depositState == "Created"))
155- then ScriptResult(WriteSet([DataEntry((assetName + "_DepositOwner"), callerPub), DataEntry((assetName + "_DepositState"), "Active"), DataEntry((assetName + "_DividendsWithdrawn"), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(DragonFruitAddress), amount, pmt.assetId)]))
155+ then ScriptResult(WriteSet([DataEntry((assetName + "_DepositOwner"), callerPub), DataEntry((assetName + "_DepositState"), "Active"), DataEntry((assetName + "_DividendWithdrawn"), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(DragonFruitAddress), amount, pmt.assetId)]))
156156 else throw("Deposit is unavailable")
157157 }
158158
165165 let dividendsPercent = getDividendsPercent(assetName)
166166 let dividendsWithdrawn = getDividendsWithdrawnAmount(assetName)
167167 let dividendsAvaliable = getDividendBalance(assetId, dividendsWithdrawn, dividendsPercent)
168- ScriptResult(WriteSet([DataEntry((assetName + "_DividendsWithdrawn"), (dividendsWithdrawn + dividendsAvaliable))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(depositOwner)), dividendsAvaliable, assetId)]))
168+ ScriptResult(WriteSet([DataEntry((assetName + "_DividendWithdrawn"), (dividendsWithdrawn + dividendsAvaliable))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(depositOwner)), dividendsAvaliable, assetId)]))
169169 }
170170
171171
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let wavelet = 100000000
55
66 let wavesDepositAmt = (2600 * wavelet)
77
88 let btcDepositAmt = ((2600 * wavelet) / 10000)
99
1010 let ethDepositAmt = (13 * wavelet)
1111
1212 let ltcDepositAmt = (39 * wavelet)
1313
1414 let westDepositAmt = (26000 * wavelet)
1515
1616 let wctDepositAmt = (26000 * wavelet)
1717
1818 let DragonFruitAddress = "3MzDG9rt13Eu5uw4mZqkG5axDiijvVSDbjc"
1919
2020 let divProgramPub = fromBase58String("A4bJfnBhBTVh7GRNr1hHz6iqJta6eBbaExPDG7UapoaD")
2121
2222 let adminPub = fromBase58String("5yjcfvH6iuwrkFghXuWaJeMppaQ893FSs8HCAgVQzuNY")
2323
2424 let wavesAssetId = unit
2525
2626 let btcAssetId = base58'8HRQdqJBBeqZvgMtg6we6sw11i5GzpFNs7onNeVRBmaq'
2727
2828 let ethAssetId = base58'4oHq3C7ar7kmcRHEZBrgPyGtU6fkqJ1pHoRYboKeYSWQ'
2929
3030 let ltcAssetId = base58'Gd9pdZw9muDBZwwsQLqyigRJCDABbiJaksmemzFCorsV'
3131
3232 let westAssetId = base58'C2Pz1Q9QYaF9MkK9J9mX9vAMVc25R3w6Lr5g5B5Yje87'
3333
3434 let wctAssetId = base58'AMQkRmWSWHEd1nMDvDZFkadoCFCxRkDzBsEbscJ9ZZ2P'
3535
3636 func callerIsAdmin (callerPublicKey) = if ((callerPublicKey == adminPub))
3737 then callerPublicKey
3838 else throw("You cannot create deposits")
3939
4040
4141 func callerIsDepositOwner (assetName,callerPublicKey) = {
4242 let depositOwner = getString(this, (assetName + "_DepositOwner"))
4343 if ((callerPublicKey == depositOwner))
4444 then callerPublicKey
4545 else throw("Only deposit owner can withdrawal dividends")
4646 }
4747
4848
4949 func depositCreatedCheck (assetName) = {
5050 let key = (assetName + "_DepositOwner")
5151 let val = getString(this, key)
5252 match val {
5353 case a: String =>
5454 true
5555 case _ =>
5656 false
5757 }
5858 }
5959
6060
6161 func amountCheck (assetName,pmtAmount) = {
6262 let key = (assetName + "_DepositAmount")
6363 let val = getInteger(this, key)
6464 let depositAmount = match val {
6565 case a: Int =>
6666 a
6767 case _ =>
6868 throw("Couldn't find deposit amount")
6969 }
7070 if ((pmtAmount == depositAmount))
7171 then pmtAmount
7272 else throw("Amount is incorrect")
7373 }
7474
7575
7676 func assetBase58ToName (assetId) = if (!(isDefined(assetId)))
7777 then "WAVES"
7878 else if ((assetId == btcAssetId))
7979 then "BTC"
8080 else if ((assetId == ethAssetId))
8181 then "ETH"
8282 else if ((assetId == ltcAssetId))
8383 then "LTC"
8484 else if ((assetId == westAssetId))
8585 then "VST"
8686 else if ((assetId == wctAssetId))
8787 then "WCT"
8888 else throw("AssetId is incorrect")
8989
9090
9191 func assetNameToBase58 (assetName) = if ((assetName == "WAVES"))
9292 then wavesAssetId
9393 else if ((assetName == "BTC"))
9494 then btcAssetId
9595 else if ((assetName == "ETH"))
9696 then ethAssetId
9797 else if ((assetName == "LTC"))
9898 then ltcAssetId
9999 else if ((assetName == "VST"))
100100 then westAssetId
101101 else if ((assetName == "WCT"))
102102 then wctAssetId
103103 else throw("Asset name is incorrect")
104104
105105
106106 func getDividendsPercent (assetName) = {
107107 let key = (assetName + "_DividendPercent")
108108 let val = getInteger(this, key)
109109 match val {
110110 case a: Int =>
111111 a
112112 case _ =>
113113 throw("Couldn't Find dividend percent")
114114 }
115115 }
116116
117117
118118 func getDividendsWithdrawnAmount (assetName) = {
119- let val = getInteger(this, (assetName + "_DividendsWithdrawn"))
119+ let val = getInteger(this, (assetName + "_DividendWithdrawn"))
120120 match val {
121121 case a: Int =>
122122 a
123123 case _ =>
124124 0
125125 }
126126 }
127127
128128
129129 func getDividendBalance (assetId,dividendsWithdrawn,dividendsPercent) = {
130130 let dividendsTotalBalance = (assetBalance(this, assetId) + dividendsWithdrawn)
131131 let userStake = ((dividendsTotalBalance * dividendsPercent) / 100)
132132 (userStake - dividendsWithdrawn)
133133 }
134134
135135
136136 @Callable(i)
137137 func createDeposit (assetName,amount,deividendPercent,startHeight,durationBlocks,startTimestamp) = {
138138 let callerPub = callerIsAdmin(i.callerPublicKey)
139139 let depositAlreadyCreated = depositCreatedCheck(assetName)
140140 if (depositAlreadyCreated)
141141 then throw("Deposit is already created")
142142 else WriteSet([DataEntry((assetName + "_DepositState"), "Created"), DataEntry((assetName + "_DepositAmount"), amount), DataEntry((assetName + "_DividendPercent"), deividendPercent), DataEntry((assetName + "_DepositStartBlock"), startHeight), DataEntry((assetName + "_DepositStartTimestamp"), startTimestamp), DataEntry((assetName + "_DepositDurationBlock"), durationBlocks)])
143143 }
144144
145145
146146
147147 @Callable(i)
148148 func deposit () = {
149149 let callerPub = toBase58String(i.callerPublicKey)
150150 let pmt = extract(i.payment)
151151 let assetName = assetBase58ToName(pmt.assetId)
152152 let amount = amountCheck(assetName, pmt.amount)
153153 let depositState = getString(this, (assetName + "_DepositState"))
154154 if ((depositState == "Created"))
155- then ScriptResult(WriteSet([DataEntry((assetName + "_DepositOwner"), callerPub), DataEntry((assetName + "_DepositState"), "Active"), DataEntry((assetName + "_DividendsWithdrawn"), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(DragonFruitAddress), amount, pmt.assetId)]))
155+ then ScriptResult(WriteSet([DataEntry((assetName + "_DepositOwner"), callerPub), DataEntry((assetName + "_DepositState"), "Active"), DataEntry((assetName + "_DividendWithdrawn"), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(DragonFruitAddress), amount, pmt.assetId)]))
156156 else throw("Deposit is unavailable")
157157 }
158158
159159
160160
161161 @Callable(i)
162162 func withdrawDividends (assetName) = {
163163 let assetId = assetNameToBase58(assetName)
164164 let depositOwner = callerIsDepositOwner(assetName, toBase58String(i.callerPublicKey))
165165 let dividendsPercent = getDividendsPercent(assetName)
166166 let dividendsWithdrawn = getDividendsWithdrawnAmount(assetName)
167167 let dividendsAvaliable = getDividendBalance(assetId, dividendsWithdrawn, dividendsPercent)
168- ScriptResult(WriteSet([DataEntry((assetName + "_DividendsWithdrawn"), (dividendsWithdrawn + dividendsAvaliable))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(depositOwner)), dividendsAvaliable, assetId)]))
168+ ScriptResult(WriteSet([DataEntry((assetName + "_DividendWithdrawn"), (dividendsWithdrawn + dividendsAvaliable))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(depositOwner)), dividendsAvaliable, assetId)]))
169169 }
170170
171171
172172 @Verifier(tx)
173173 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], divProgramPub))
174174 then match tx {
175175 case sstx: SetScriptTransaction =>
176176 true
177177 case ttx: TransferTransaction =>
178178 let assetName = assetBase58ToName(ttx.assetId)
179179 let dividendsPercent = getDividendsPercent(assetName)
180180 let dividendsWithdrawn = getDividendsWithdrawnAmount(assetName)
181181 let dividends = getDividendBalance(ttx.assetId, dividendsWithdrawn, dividendsPercent)
182182 let accountBalance = assetBalance(this, ttx.assetId)
183183 ((accountBalance - ttx.amount) >= dividends)
184184 case itx: InvokeScriptTransaction =>
185185 true
186186 case _ =>
187187 false
188188 }
189189 else false
190190

github/deemru/w8io/fabc49c 
32.68 ms