tx · 8TBiCqFHMkk3jgTp3wrCBNmp3hicFZRnai3Jd2dcPPqw

3MsYACqD4rYSStRZp2nAHgomkSRhH5VCduV:  -0.01000000 Waves

2020.06.15 15:06 [1044565] smart account 3MsYACqD4rYSStRZp2nAHgomkSRhH5VCduV > SELF 0.00000000 Waves

{ "type": 13, "id": "8TBiCqFHMkk3jgTp3wrCBNmp3hicFZRnai3Jd2dcPPqw", "fee": 1000000, "feeAssetId": null, "timestamp": 1592222810005, "version": 1, "sender": "3MsYACqD4rYSStRZp2nAHgomkSRhH5VCduV", "senderPublicKey": "G4BAm7Pd6r5MUCCgFk8NktCLHfDjU6w8TGUpyAmiYp72", "proofs": [ "3RHD4FPKYcFWRxLX7aBPTEUZdCXE8Umf97EVsWXRfQn2MHrpJWfLjWkJEhr1q8SJwiHBP6P8rZXjfAftk6nt3ByC" ], "script": "base64:AAIDAAAAAAAAAAkIARIDCgEIEgAAAAAgAAAAAAthZGRyZXNzQm9vawkBAAAAB0FkZHJlc3MAAAABAQAAABoBVFaB1Hk0Ezu+4mjGjtAsjfi5cnbAV28B3gAAAAATd2hpdGVsaXN0QWRkcmVzc0tleQIAAAAQd2hpdGVsaXN0QWRkcmVzcwAAAAAXZEFwcFdoaXRlbGlzdEFkZHJlc3NLZXkCAAAAFGRBcHBXaGl0ZWxpc3RBZGRyZXNzAAAAAA5jb2VmZmljaWVudEtleQIAAAALY29lZmZpY2llbnQAAAAAEGlzc3VlckFkZHJlc3NLZXkCAAAABmlzc3VlcgAAAAAUaXNzdWVyQWRkcmVzc1BhaWRLZXkCAAAAC2lzc3Vlcl9wYWlkAAAAABppc3N1ZXJBZGRyZXNzUGFpZEFtb3VudEtleQIAAAARaXNzdWVyX3BhaWRBbW91bnQAAAAAEnRyYW5zZmVyc05lZWRlZEtleQIAAAAQdHJhbnNmZXJzX25lZWRlZAAAAAAVdHJhbnNmZXJzQ29tcGxldGVkS2V5AgAAABN0cmFuc2ZlcnNfY29tcGxldGVkAAAAABBkaXZpZ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RGVmaW5lZAAAAAEJAAQaAAAAAgUAAAAJcEFkZHJlc3M4BQAAAAR0eElkAAAAAAAAAAABAAAAAAAAAAAACQAAZwAAAAIJAABkAAAAAgkAAGQAAAACCQAAZAAAAAIJAABkAAAAAgkAAGQAAAACCQAAZAAAAAIJAABkAAAAAgUAAAALcEtleTFTaWduZWQFAAAAC3BLZXkyU2lnbmVkBQAAAAtwS2V5M1NpZ25lZAUAAAALcEtleTRTaWduZWQFAAAAC3BLZXk1U2lnbmVkBQAAAAtwS2V5NlNpZ25lZAUAAAALcEtleTdTaWduZWQFAAAAC3BLZXk4U2lnbmVkAAAAAAAAAAADAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAnR4BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQc2v9HL", "chainId": 84, "height": 1044565, "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 addressBook = Address(base58'3MwoVRAPfC2NKuuYJKHVAVtUFhq8MyTEfQh')
5+
6+let whitelistAddressKey = "whitelistAddress"
7+
8+let dAppWhitelistAddressKey = "dAppWhitelistAddress"
9+
10+let coefficientKey = "coefficient"
11+
12+let issuerAddressKey = "issuer"
13+
14+let issuerAddressPaidKey = "issuer_paid"
15+
16+let issuerAddressPaidAmountKey = "issuer_paidAmount"
17+
18+let transfersNeededKey = "transfers_needed"
19+
20+let transfersCompletedKey = "transfers_completed"
21+
22+let dividendsAssetId = base58'Co11Tbj83TeZCnuXrZQwv6Bs4XG2sm1vGQiQ4FLDjJWs'
23+
24+let dividendsAssetIsWaves = false
25+
26+let securityAssetDecimalsOffset = 100000000
27+
28+let startTime = 1592222880
29+
30+let endTime = 1623758880
31+
32+let ver = "5.0.1"
33+
34+let validState = 1000
35+
36+let getCurrentTime = (lastBlock.timestamp / 1000)
37+
38+func hasStarted () = (getCurrentTime >= startTime)
39+
40+
41+func hasEnded () = (getCurrentTime > endTime)
42+
43+
44+func getAddressFromBook (key) = match getString(addressBook, key) {
45+ case a: String =>
46+ Address(fromBase58String(a))
47+ case _ =>
48+ throw("no key")
49+}
50+
51+
52+func getAmount (key) = match getInteger(this, key) {
53+ case a: Int =>
54+ a
55+ case _ =>
56+ 0
57+}
58+
59+
60+func isPaid (key) = match getBoolean(this, key) {
61+ case a: Boolean =>
62+ a
63+ case _ =>
64+ false
65+}
66+
67+
68+func getAssetIdForTransfer (isWaves,assetId) = if ((isWaves == false))
69+ then assetId
70+ else unit
71+
72+
73+func getAssetBalanceForTransfer (isWaves,assetId) = if ((isWaves == false))
74+ then assetBalance(this, assetId)
75+ else wavesBalance(this)
76+
77+
78+func getInvestorAddressForWithdrawal (argAddress,callerAddress) = if ((size(argAddress) > 10))
79+ then argAddress
80+ else callerAddress
81+
82+
83+let whitelistAddress = getAddressFromBook(whitelistAddressKey)
84+
85+let dAppWhitelistAddress = getAddressFromBook(dAppWhitelistAddressKey)
86+
87+let dividendsAssetIdForTransfer = getAssetIdForTransfer(dividendsAssetIsWaves, dividendsAssetId)
88+
89+let issuerAddressPaid = isPaid(issuerAddressPaidKey)
90+
91+let balance = getAssetBalanceForTransfer(dividendsAssetIsWaves, dividendsAssetId)
92+
93+let transfersNeeded = getAmount(transfersNeededKey)
94+
95+let transfersCompleted = getAmount(transfersCompletedKey)
96+
97+@Callable(i)
98+func withdrawal (address) = {
99+ let dAppStatus = match getInteger(dAppWhitelistAddress, toString(this)) {
100+ case a: Int =>
101+ a
102+ case _ =>
103+ 0
104+ }
105+ let currentKey = getInvestorAddressForWithdrawal(address, toString(i.caller))
106+ let currentKeyAddress = extract(addressFromString(currentKey))
107+ let addressTokensKey = (("address_" + currentKey) + "_tokens")
108+ let addressPaidKey = (("address_" + currentKey) + "_paid")
109+ let addressPaidAmountKey = (("address_" + currentKey) + "_paidAmount")
110+ let addressSecurityTokens = getAmount(addressTokensKey)
111+ let addressPaid = isPaid(addressPaidKey)
112+ if ((dAppStatus != 1))
113+ then throw("#001 dApp is not active")
114+ else if (!(hasStarted()))
115+ then throw("#002 dApp has not started yet")
116+ else if (hasEnded())
117+ then throw("#003 dApp already completed")
118+ else if ((addressSecurityTokens == 0))
119+ then throw("#005 This account does not have dividends to recieve.")
120+ else if ((addressPaid == true))
121+ then throw("#006 This account has already received dividends.")
122+ else {
123+ let coefficient = getAmount(coefficientKey)
124+ let amount = fraction(addressSecurityTokens, coefficient, securityAssetDecimalsOffset)
125+ ScriptResult(WriteSet([DataEntry(addressPaidKey, true), DataEntry(transfersCompletedKey, (transfersCompleted + 1)), DataEntry(addressPaidAmountKey, amount)]), TransferSet([ScriptTransfer(currentKeyAddress, amount, dividendsAssetIdForTransfer)]))
126+ }
127+ }
128+
129+
130+
131+@Callable(i)
132+func getBalance () = {
133+ let dAppStatus = match getInteger(dAppWhitelistAddress, toString(this)) {
134+ case a: Int =>
135+ a
136+ case _ =>
137+ 0
138+ }
139+ let issuerAddress = match getString(this, issuerAddressKey) {
140+ case a: String =>
141+ Address(fromBase58String(a))
142+ case _ =>
143+ throw("no issuer address key")
144+ }
145+ if ((dAppStatus != 1))
146+ then throw("#001 dApp is not active")
147+ else if (!(hasStarted()))
148+ then throw("#002 dApp has not started yet")
149+ else if (if ((transfersNeeded != transfersCompleted))
150+ then true
151+ else (transfersNeeded == 0))
152+ then throw("#010 This account waits for transfer")
153+ else if ((issuerAddressPaid == true))
154+ then throw("#012 This account has already received balance")
155+ else ScriptResult(WriteSet([DataEntry(issuerAddressPaidKey, true), DataEntry(issuerAddressPaidAmountKey, balance)]), TransferSet([ScriptTransfer(issuerAddress, balance, dividendsAssetIdForTransfer)]))
156+ }
157+
158+
159+@Verifier(tx)
160+func verify () = match tx {
161+ case tx: SetScriptTransaction =>
162+ let txId = toBase58String(tx.id)
163+ let pAddress1 = getAddressFromBook("pAddress1")
164+ let pAddress2 = getAddressFromBook("pAddress2")
165+ let pAddress3 = getAddressFromBook("pAddress3")
166+ let pAddress4 = getAddressFromBook("pAddress4")
167+ let pAddress5 = getAddressFromBook("pAddress5")
168+ let pAddress6 = getAddressFromBook("pAddress6")
169+ let pAddress7 = getAddressFromBook("pAddress7")
170+ let pAddress8 = getAddressFromBook("pAddress8")
171+ let pKey1Signed = if (isDefined(getInteger(pAddress1, txId)))
172+ then 1
173+ else 0
174+ let pKey2Signed = if (isDefined(getInteger(pAddress2, txId)))
175+ then 1
176+ else 0
177+ let pKey3Signed = if (isDefined(getInteger(pAddress3, txId)))
178+ then 1
179+ else 0
180+ let pKey4Signed = if (isDefined(getInteger(pAddress4, txId)))
181+ then 1
182+ else 0
183+ let pKey5Signed = if (isDefined(getInteger(pAddress5, txId)))
184+ then 1
185+ else 0
186+ let pKey6Signed = if (isDefined(getInteger(pAddress6, txId)))
187+ then 1
188+ else 0
189+ let pKey7Signed = if (isDefined(getInteger(pAddress7, txId)))
190+ then 1
191+ else 0
192+ let pKey8Signed = if (isDefined(getInteger(pAddress8, txId)))
193+ then 1
194+ else 0
195+ ((((((((pKey1Signed + pKey2Signed) + pKey3Signed) + pKey4Signed) + pKey5Signed) + pKey6Signed) + pKey7Signed) + pKey8Signed) >= 3)
196+ case tx: DataTransaction =>
197+ sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
198+ case _ =>
199+ false
200+}
201+

github/deemru/w8io/169f3d6 
63.41 ms