tx · B1oLpBAkiLBcugRzVaNnxg8qu12ZrHZ4P5oyiQCeAwj

3N6VbAeiZ1dPMdSBSu5fDWhtvM2vvmZtUb6:  -0.01000000 Waves

2019.12.25 14:12 [824445] smart account 3N6VbAeiZ1dPMdSBSu5fDWhtvM2vvmZtUb6 > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
17.61 ms