tx · HBkjtxwToBwT8ZimyXdAdBBEg3cdpJuivQoge9jh2NG8

3MpVunRPnNPuBCtAb95NPY1Q1aNf43a6Gyh:  -0.01000000 Waves

2019.12.18 14:35 [814283] smart account 3MpVunRPnNPuBCtAb95NPY1Q1aNf43a6Gyh > SELF 0.00000000 Waves

{ "type": 13, "id": "HBkjtxwToBwT8ZimyXdAdBBEg3cdpJuivQoge9jh2NG8", "fee": 1000000, "feeAssetId": null, "timestamp": 1576668709745, "version": 1, "sender": "3MpVunRPnNPuBCtAb95NPY1Q1aNf43a6Gyh", "senderPublicKey": "HMJMUXBatArd2SDvjv3YbtdrY2BAsxDEfWhqv8kYH4Kj", "proofs": [ "3Q8Y6CRzi8MBY6dPh7wtSn1Nj3KF63ZNexfNSziRSPBgc15LkNNeS6R9aToLDYWxCMsLhLWpNaDHYadL7EPRbXqd" ], "script": "base64:AAIDAAAAAAAAABUIARIAEgMKAQgSAwoBCBIFCgMIAQgAAAAUAAAAAAhXYXZlc1B1YgkAAlkAAAABAgAAACw0N3lWeDd5N1E5Q1A5VmJBWWduczc2WU1EbXhlZUd6MlJFem1WWnNCQzgzZwAAAAASRHJhZ29uRnJ1aXRBZGRyZXNzAgAAACMzTXFwNDUzNjF3Q3V0YUtFcU0ya0NiRlptcmtvZFFHdnBVRQAAAAAIYWRtaW5QdWIJAAJZAAAAAQIAAAAsQ201YVBXdEE2UHVmYVpTNWtlZzFaTW5EU3pFaXdrVUhDWnNURmtkcjhZd1AAAAAACG93bmVyUHViCQACWQAAAAECAAAALEhNSk1VWEJhdEFyZDJTRHZqdjNZYnRkclkyQkFzeERFZldocXY4a1lINEtqAAAAAAxmcmVlemluZ1RpbWUAAAAAAAAAAAEAAAAADHdhdmVzQXNzZXRJZAUAAAAEdW5pdAAAAAAKYnRjQXNzZXRJZAEAAAABAAAAAAAKZXRoQXNzZXRJZAEAAAABAAAAAAAKbHRjQXNzZXRJZAEAAAABAAAAAAALd2VzdEFzc2V0SWQBAAAAAQAAAAAAC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RlbmRCYWxhbmNlCQEAAAAaZ2V0SW52ZXN0b3JEaXZpZGVuZEJhbGFuY2UAAAAACQAAZwAAAAIJAABlAAAAAgUAAAAOYWNjb3VudEJhbGFuY2UIBQAAAAN0dHgAAAAGYW1vdW50BQAAABdpbnZlc3RvckRpdmlkZW5kQmFsYW5jZQcHpcThAQ==", "chainId": 84, "height": 814283, "spentComplexity": 0 } View: original | compacted Prev: none Next: GNhFL44CgAcuVgymGrDxheB5adkPs1nZBTF845nS8dUx Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let WavesPub = fromBase58String("47yVx7y7Q9CP9VbAYgns76YMDmxeeGz2REzmVZsBC83g")
5+
6+let DragonFruitAddress = "3Mqp45361wCutaKEqM2kCbFZmrkodQGvpUE"
7+
8+let adminPub = fromBase58String("Cm5aPWtA6PufaZS5keg1ZMnDSzEiwkUHCZsTFkdr8YwP")
9+
10+let ownerPub = fromBase58String("HMJMUXBatArd2SDvjv3YbtdrY2BAsxDEfWhqv8kYH4Kj")
11+
12+let freezingTime = 1
13+
14+let wavesAssetId = unit
15+
16+let btcAssetId = base58'1'
17+
18+let ethAssetId = base58'1'
19+
20+let ltcAssetId = base58'1'
21+
22+let westAssetId = base58'1'
23+
24+let wctAssetId = base58'1'
25+
26+func callerPubIsPredefined (callerPublicKey) = if ((callerPublicKey == WavesPub))
27+ then toBase58String(callerPublicKey)
28+ else throw("Only predefined public keys can make deposits")
29+
30+
31+func assetBase58ToName (assetId) = if (!(isDefined(assetId)))
32+ then "WAVES"
33+ else if ((assetId == btcAssetId))
34+ then "BTC"
35+ else if ((assetId == ethAssetId))
36+ then "ETH"
37+ else if ((assetId == ltcAssetId))
38+ then "LTC"
39+ else if ((assetId == westAssetId))
40+ then "VST"
41+ else if ((assetId == wctAssetId))
42+ then "WCT"
43+ else throw("AssetId is incorrect")
44+
45+
46+func assetNameToBase58 (assetName) = if ((assetName == "WAVES"))
47+ then wavesAssetId
48+ else if ((assetName == "BTC"))
49+ then btcAssetId
50+ else if ((assetName == "ETH"))
51+ then ethAssetId
52+ else if ((assetName == "LTC"))
53+ then ltcAssetId
54+ else if ((assetName == "VST"))
55+ then westAssetId
56+ else if ((assetName == "WCT"))
57+ then wctAssetId
58+ else throw("Asset name is incorrect")
59+
60+
61+func setNewDepositAmount (callerPub,pmtAssetId,amount) = {
62+ let a = match getInteger(this, (((callerPub + "_") + pmtAssetId) + "_DepositAmount")) {
63+ case a: Int =>
64+ a
65+ case _ =>
66+ 0
67+ }
68+ (a + amount)
69+ }
70+
71+
72+func getDividendsBalance (assetId,callerPub,assetName) = {
73+ let totalBalance = assetBalance(this, assetId)
74+ let depositedBalance = {
75+ let key = (((callerPub + "_") + assetName) + "_DepositAmount")
76+ let val = getInteger(this, key)
77+ match val {
78+ case a: Int =>
79+ a
80+ case _ =>
81+ 0
82+ }
83+ }
84+ ((totalBalance - depositedBalance) / 5)
85+ }
86+
87+
88+func callerPubCheck (callerPublicKey,pmtAssetId) = {
89+ let key = (((callerPublicKey + "_") + pmtAssetId) + "_DepositAmount")
90+ let val = getInteger(this, key)
91+ match val {
92+ case a: Int =>
93+ callerPublicKey
94+ case _ =>
95+ throw("Couldn't find deposit amount for this user")
96+ }
97+ }
98+
99+
100+func getDepositHeight (callerPub) = {
101+ let key = (callerPub + "_DepositHeight")
102+ let val = getInteger(this, key)
103+ match val {
104+ case a: Int =>
105+ a
106+ case _ =>
107+ throw("Couldn't find deposit height")
108+ }
109+ }
110+
111+
112+func getDepositBalance (callerPub,pmtAssetId) = {
113+ let key = (((callerPub + "_") + pmtAssetId) + "_DepositAmount")
114+ let val = getInteger(this, key)
115+ match val {
116+ case a: Int =>
117+ a
118+ case _ =>
119+ throw("Couldn't find deposit balance")
120+ }
121+ }
122+
123+
124+func getInvestorDividendBalance () = {
125+ let key = (toBase58String(WavesPub) + "_DividendBalance")
126+ let val = getInteger(this, key)
127+ match val {
128+ case a: Int =>
129+ a
130+ case _ =>
131+ 0
132+ }
133+ }
134+
135+
136+@Callable(i)
137+func deposit () = {
138+ let callerPub = callerPubIsPredefined(i.callerPublicKey)
139+ let pmt = extract(i.payment)
140+ let amount = pmt.amount
141+ let pmtAssetId = assetBase58ToName(pmt.assetId)
142+ let callerNewDepositAmount = setNewDepositAmount(callerPub, pmtAssetId, amount)
143+ WriteSet([DataEntry((((callerPub + "_") + pmtAssetId) + "_DepositAmount"), callerNewDepositAmount), DataEntry((callerPub + "_DepositHeight"), height)])
144+ }
145+
146+
147+
148+@Callable(i)
149+func withdrawDividends (assetName) = {
150+ let assetId = assetNameToBase58(assetName)
151+ let callerPub = callerPubCheck(toBase58String(i.callerPublicKey), assetName)
152+ let dividends = getDividendsBalance(assetId, callerPub, assetName)
153+ ScriptResult(WriteSet([DataEntry((callerPub + "_DividendBalance"), 0)]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(callerPub)), dividends, assetId)]))
154+ }
155+
156+
157+
158+@Callable(i)
159+func withdrawDeposit (assetName) = {
160+ let pmtAssetId = assetNameToBase58(assetName)
161+ let callerPub = callerPubCheck(toBase58String(i.callerPublicKey), assetName)
162+ let dAppBalance = assetBalance(this, pmtAssetId)
163+ let depositHeight = getDepositHeight(callerPub)
164+ let heightDifference = (height - depositHeight)
165+ let depositBalance = getDepositBalance(callerPub, assetName)
166+ let avaliableBalance = if (((dAppBalance - depositBalance) >= 0))
167+ then depositBalance
168+ else dAppBalance
169+ if ((heightDifference > freezingTime))
170+ then ScriptResult(WriteSet([DataEntry((((callerPub + "_") + assetName) + "_DepositAmount"), (depositBalance - avaliableBalance))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(callerPub)), avaliableBalance, pmtAssetId)]))
171+ else throw((("Freezing time is not over. " + toString(heightDifference)) + " blocks left"))
172+ }
173+
174+
175+
176+@Callable(i)
177+func sendToGameBalance (recipient,amount,assetName) = {
178+ let callerPub = if ((i.callerPublicKey == adminPub))
179+ then i.callerPublicKey
180+ else throw("You cannot send funds to game accounts")
181+ let recipientCheck = if ((recipient == DragonFruitAddress))
182+ then recipient
183+ else throw("Funds can be sent on to defined game addresses")
184+ let assetId = assetNameToBase58(assetName)
185+ ScriptResult(WriteSet(nil), TransferSet([ScriptTransfer(addressFromStringValue(recipientCheck), amount, assetId)]))
186+ }
187+
188+
189+@Verifier(tx)
190+func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], ownerPub))
191+ then match tx {
192+ case sstx: SetScriptTransaction =>
193+ true
194+ case ttx: TransferTransaction =>
195+ let accountBalance = assetBalance(this, ttx.assetId)
196+ let investorDividendBalance = getInvestorDividendBalance()
197+ ((accountBalance - ttx.amount) >= investorDividendBalance)
198+ case _ =>
199+ false
200+ }
201+ else false
202+

github/deemru/w8io/026f985 
27.23 ms