tx · EZr1wmo5hZ1fg3DfveQaJUqmvSnHmZh3dmHTKynMakKb

3MvRELGDi1GGBfRaSxz7ceHjkCvQAkRJGQ6:  -0.01400000 Waves

2019.12.24 15:39 [823096] smart account 3MvRELGDi1GGBfRaSxz7ceHjkCvQAkRJGQ6 > SELF 0.00000000 Waves

{ "type": 13, "id": "EZr1wmo5hZ1fg3DfveQaJUqmvSnHmZh3dmHTKynMakKb", "fee": 1400000, "feeAssetId": null, "timestamp": 1577191188346, "version": 1, "sender": "3MvRELGDi1GGBfRaSxz7ceHjkCvQAkRJGQ6", "senderPublicKey": "GwE9c1PFiWxg2oWXxnKKcPkvLWgs4DNDCxxHNEBpBPq1", "proofs": [ "WQmxqQyp8urEjVgEwgyLtwNGNYZiDGdYqaHxqMoAJWrkUh5YUB5ZPR4WbBgz1KDFFbxZYarXpAKMreYbSg4J6XN" ], "script": "base64:AAIDAAAAAAAAABIIARIHCgUIAQEBARIAEgMKAQgAAAAZAAAAAAd3YXZlbGV0AAAAAAAF9eEAAAAAAA93YXZlc0RlcG9zaXRBbXQJAABoAAAAAgAAAAAAAAAKKAUAAAAHd2F2ZWxldAAAAAANYnRjRGVwb3NpdEFtdAkAAGkAAAACCQAAaAAAAAIAAAAAAAAACigFAAAAB3dhdmVsZXQAAAAAAAAAJxAAAAAADWV0aERlcG9zaXRBbXQJAABoAAAAAgAAAAAAAAAADQUAAAAHd2F2ZWxldAAAAAANbHRjRGVwb3NpdEFtdAkAAGgAAAACAAAAAAAAAAAnBQAAAAd3YXZlbGV0AAAAAA53ZXN0RGVwb3NpdEFtdAkAAGgAAAACAAAAAAAAAGWQBQAAAAd3YXZlbGV0AAAAAA13Y3REZXBvc2l0QW10CQAAaAAAAAIAAAAAAAAAZZAFAAAAB3dhdmVsZXQAAAAAEkRyYWdvbkZydWl0QWRkcmVzcwIAAAAjM01xcDQ1MzYxd0N1dGFLRXFNMmtDYkZabXJrb2RRR3ZwVUUAAAAADWRpdlByb2dyYW1QdWIJAAJZA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wuC4=", "chainId": 84, "height": 823096, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let wavelet = 100000000
5+
6+let wavesDepositAmt = (2600 * wavelet)
7+
8+let btcDepositAmt = ((2600 * wavelet) / 10000)
9+
10+let ethDepositAmt = (13 * wavelet)
11+
12+let ltcDepositAmt = (39 * wavelet)
13+
14+let westDepositAmt = (26000 * wavelet)
15+
16+let wctDepositAmt = (26000 * wavelet)
17+
18+let DragonFruitAddress = "3Mqp45361wCutaKEqM2kCbFZmrkodQGvpUE"
19+
20+let divProgramPub = fromBase58String("HMJMUXBatArd2SDvjv3YbtdrY2BAsxDEfWhqv8kYH4Kj")
21+
22+let adminPub = fromBase58String("GwE9c1PFiWxg2oWXxnKKcPkvLWgs4DNDCxxHNEBpBPq1")
23+
24+let wavesAssetId = unit
25+
26+let btcAssetId = base58'1'
27+
28+let ethAssetId = base58'1'
29+
30+let ltcAssetId = base58'1'
31+
32+let westAssetId = base58'1'
33+
34+let wctAssetId = base58'1'
35+
36+func callerIsAdmin (callerPublicKey) = if ((callerPublicKey == adminPub))
37+ then callerPublicKey
38+ else throw("You cannot create deposits")
39+
40+
41+func callerIsDepositOwner (assetName,callerPublicKey) = {
42+ let depositOwner = getString(this, (assetName + "_DepositOwner"))
43+ if ((callerPublicKey == depositOwner))
44+ then callerPublicKey
45+ else throw("Only deposit owner can withdrawal dividends")
46+ }
47+
48+
49+func depositCreatedCheck (assetName) = {
50+ let key = (assetName + "_DepositOwner")
51+ let val = getString(this, key)
52+ match val {
53+ case a: String =>
54+ true
55+ case _ =>
56+ false
57+ }
58+ }
59+
60+
61+func amountCheck (assetName,pmtAmount) = {
62+ let key = (assetName + "_DepositAmount")
63+ let val = getInteger(this, key)
64+ let depositAmount = match val {
65+ case a: Int =>
66+ a
67+ case _ =>
68+ throw("Couldn't find deposit amount")
69+ }
70+ if ((pmtAmount == depositAmount))
71+ then pmtAmount
72+ else throw("Amount is incorrect")
73+ }
74+
75+
76+func assetBase58ToName (assetId) = if (!(isDefined(assetId)))
77+ then "WAVES"
78+ else if ((assetId == btcAssetId))
79+ then "BTC"
80+ else if ((assetId == ethAssetId))
81+ then "ETH"
82+ else if ((assetId == ltcAssetId))
83+ then "LTC"
84+ else if ((assetId == westAssetId))
85+ then "VST"
86+ else if ((assetId == wctAssetId))
87+ then "WCT"
88+ else throw("AssetId is incorrect")
89+
90+
91+func assetNameToBase58 (assetName) = if ((assetName == "WAVES"))
92+ then wavesAssetId
93+ else if ((assetName == "BTC"))
94+ then btcAssetId
95+ else if ((assetName == "ETH"))
96+ then ethAssetId
97+ else if ((assetName == "LTC"))
98+ then ltcAssetId
99+ else if ((assetName == "VST"))
100+ then westAssetId
101+ else if ((assetName == "WCT"))
102+ then wctAssetId
103+ else throw("Asset name is incorrect")
104+
105+
106+func getDividendsPercent (assetName) = {
107+ let key = (assetName + "_DividendPercent")
108+ let val = getInteger(this, key)
109+ match val {
110+ case a: Int =>
111+ a
112+ case _ =>
113+ throw("Couldn't Find dividend percent")
114+ }
115+ }
116+
117+
118+func getDividendsWithdrawnAmount (assetName) = {
119+ let val = getInteger(this, (assetName + "_DividendsWithdrawn"))
120+ match val {
121+ case a: Int =>
122+ a
123+ case _ =>
124+ 0
125+ }
126+ }
127+
128+
129+func getDividendBalance (assetId,dividendsWithdrawn,dividendsPercent) = {
130+ let dividendsTotalBalance = (assetBalance(this, assetId) + dividendsWithdrawn)
131+ let userStake = ((dividendsTotalBalance * dividendsPercent) / 100)
132+ (userStake - dividendsWithdrawn)
133+ }
134+
135+
136+@Callable(i)
137+func createDeposit (assetName,amount,deividendPercent,heightStart,duration) = {
138+ let callerPub = callerIsAdmin(i.callerPublicKey)
139+ let depositAlreadyCreated = depositCreatedCheck(assetName)
140+ if (depositAlreadyCreated)
141+ then throw("Deposit is already created")
142+ else WriteSet([DataEntry((assetName + "_DepositState"), "Created"), DataEntry((assetName + "_DepositAmount"), amount), DataEntry((assetName + "_DividendPercent"), deividendPercent), DataEntry((assetName + "_DepositStart"), heightStart), DataEntry((assetName + "_DepositDuration"), duration)])
143+ }
144+
145+
146+
147+@Callable(i)
148+func deposit () = {
149+ let callerPub = toBase58String(i.callerPublicKey)
150+ let pmt = extract(i.payment)
151+ let assetName = assetBase58ToName(pmt.assetId)
152+ let amount = amountCheck(assetName, pmt.amount)
153+ let depositState = getString(this, (assetName + "_DepositState"))
154+ if ((depositState == "Created"))
155+ then ScriptResult(WriteSet([DataEntry((assetName + "_DepositOwner"), callerPub), DataEntry((assetName + "_DepositState"), "Active")]), TransferSet([ScriptTransfer(addressFromStringValue(DragonFruitAddress), amount, pmt.assetId)]))
156+ else throw("Deposit is unavailable")
157+ }
158+
159+
160+
161+@Callable(i)
162+func withdrawDividends (assetName) = {
163+ let assetId = assetNameToBase58(assetName)
164+ let depositOwner = callerIsDepositOwner(assetName, toBase58String(i.callerPublicKey))
165+ let dividendsPercent = getDividendsPercent(assetName)
166+ let dividendsWithdrawn = getDividendsWithdrawnAmount(assetName)
167+ let dividendsAvaliable = getDividendBalance(assetId, dividendsWithdrawn, dividendsPercent)
168+ ScriptResult(WriteSet([DataEntry((depositOwner + "_DividendsWithdrawn"), (dividendsWithdrawn + dividendsAvaliable))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(depositOwner)), dividendsAvaliable, assetId)]))
169+ }
170+
171+
172+@Verifier(tx)
173+func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], divProgramPub))
174+ then match tx {
175+ case sstx: SetScriptTransaction =>
176+ true
177+ case ttx: TransferTransaction =>
178+ let assetName = assetBase58ToName(ttx.assetId)
179+ let dividendsPercent = getDividendsPercent(assetName)
180+ let dividendsWithdrawn = getDividendsWithdrawnAmount(assetName)
181+ let dividends = getDividendBalance(ttx.assetId, dividendsWithdrawn, dividendsPercent)
182+ let accountBalance = assetBalance(this, ttx.assetId)
183+ ((accountBalance - ttx.amount) >= dividends)
184+ case itx: InvokeScriptTransaction =>
185+ true
186+ case _ =>
187+ false
188+ }
189+ else false
190+

github/deemru/w8io/026f985 
21.65 ms