tx · 3ZYQ1VprWw3MbmxUocGFGgszHX8YirYiHn4cM22oPkGG 3MzmzpgNz8uAHNNgKwDGNriv2BK8QFNAB3i: -0.01000000 Waves 2020.06.07 17:05 [1032971] smart account 3MzmzpgNz8uAHNNgKwDGNriv2BK8QFNAB3i > SELF 0.00000000 Waves
{ "type": 13, "id": "3ZYQ1VprWw3MbmxUocGFGgszHX8YirYiHn4cM22oPkGG", "fee": 1000000, "feeAssetId": null, "timestamp": 1591538739266, "version": 1, "sender": "3MzmzpgNz8uAHNNgKwDGNriv2BK8QFNAB3i", "senderPublicKey": "BmvuY9CgxmmSo3DxuarbLkHYWmRJd6CrSrLpA7yqZCpE", "proofs": [ "3od3fYNZEwUszgcw3SLx67ssos8pF3p1Zbn2Sw6zpawMoZPNUdhVKe6YqhLdYaUNN3Vqzb8vjaSDvabuiYNCY64z" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAAFgAAAAALYWRkcmVzc0Jvb2sJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVRWgdR5NBM7vuJoxo7QLI34uXJ2wFdvAd4AAAAAE3doaXRlbGlzdEFkZHJlc3NLZXkCAAAAEHdoaXRlbGlzdEFkZHJlc3MAAAAAF2RBcHBXaGl0ZWxpc3RBZGRyZXNzS2V5AgAAABRkQXBwV2hpdGVsaXN0QWRkcmVzcwAAAAAOY29lZmZpY2llbnRLZXkCAAAAC2NvZWZmaWNpZW50AAAAABBkaXZpZGVuZHNBc3NldElkAQAAAAQTq9kzAAAAABVkaXZpZGVuZHNBc3NldElzV2F2ZXMGAAAAABtzZWN1cml0eUFzc2V0RGVjaW1hbHNPZmZzZXQAAAAAAAAAAAgAAAAACXN0YXJ0VGltZQAAAAAAXuaP0AAAAAAHZW5kVGltZQAAAAAAYMfDUAAAAAADdmVyAgAAAAU1LjAuMQAAAAAKdmFsaWRTdGF0ZQAAAAAAAAAD6AAAAAAOZ2V0Q3VycmVudFRpbWUJAABpAAAAAggFAAAACWxhc3RCbG9j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BLZXk2U2lnbmVkBQAAAAtwS2V5N1NpZ25lZAUAAAALcEtleThTaWduZWQAAAAAAAAAAAMHyBhtbA==", "chainId": 84, "height": 1032971, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
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 dividendsAssetId = base58'WAVES' | |
13 | + | ||
14 | + | let dividendsAssetIsWaves = true | |
15 | + | ||
16 | + | let securityAssetDecimalsOffset = 8 | |
17 | + | ||
18 | + | let startTime = 1592168400 | |
19 | + | ||
20 | + | let endTime = 1623704400 | |
21 | + | ||
22 | + | let ver = "5.0.1" | |
23 | + | ||
24 | + | let validState = 1000 | |
25 | + | ||
26 | + | let getCurrentTime = (lastBlock.timestamp / 1000) | |
27 | + | ||
28 | + | func hasStarted () = (getCurrentTime >= startTime) | |
29 | + | ||
30 | + | ||
31 | + | func hasEnded () = (getCurrentTime > endTime) | |
32 | + | ||
33 | + | ||
34 | + | func getAddressFromBook (key) = match getString(addressBook, key) { | |
35 | + | case a: String => | |
36 | + | Address(fromBase58String(a)) | |
37 | + | case _ => | |
38 | + | throw("no key") | |
39 | + | } | |
40 | + | ||
41 | + | ||
42 | + | func getAmount (key) = match getInteger(this, key) { | |
43 | + | case a: Int => | |
44 | + | a | |
45 | + | case _ => | |
46 | + | 0 | |
47 | + | } | |
48 | + | ||
49 | + | ||
50 | + | func isPaid (key) = match getBoolean(this, key) { | |
51 | + | case a: Boolean => | |
52 | + | a | |
53 | + | case _ => | |
54 | + | false | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | func getAssetIdForTransfer (isWaves,assetId) = if ((isWaves == false)) | |
59 | + | then assetId | |
60 | + | else unit | |
61 | + | ||
62 | + | ||
63 | + | func getInvestorAddressForWithdrawal (argAddress,callerAddress) = if ((size(argAddress) > 10)) | |
64 | + | then argAddress | |
65 | + | else callerAddress | |
66 | + | ||
67 | + | ||
68 | + | let whitelistAddress = getAddressFromBook(whitelistAddressKey) | |
69 | + | ||
70 | + | let dAppWhitelistAddress = getAddressFromBook(dAppWhitelistAddressKey) | |
71 | + | ||
72 | + | let dividendsAssetIdForTransfer = getAssetIdForTransfer(dividendsAssetIsWaves, dividendsAssetId) | |
73 | + | ||
74 | + | @Callable(i) | |
75 | + | func withdrawal (address) = { | |
76 | + | let dAppStatus = match getInteger(dAppWhitelistAddress, toString(this)) { | |
77 | + | case a: Int => | |
78 | + | a | |
79 | + | case _ => | |
80 | + | 0 | |
81 | + | } | |
82 | + | let currentKey = getInvestorAddressForWithdrawal(address, toString(i.caller)) | |
83 | + | let currentKeyAddress = extract(addressFromString(currentKey)) | |
84 | + | let addressTokensKey = (("address_" + currentKey) + "_tokens") | |
85 | + | let addressPaidKey = (("address_" + currentKey) + "_paid") | |
86 | + | let addressPaidAmountKey = (("address_" + currentKey) + "_paidAmount") | |
87 | + | let addressSecurityTokens = getAmount(addressTokensKey) | |
88 | + | let addressPaid = isPaid(addressPaidKey) | |
89 | + | if ((dAppStatus != 1)) | |
90 | + | then throw("#001 dApp is not active") | |
91 | + | else if (!(hasStarted())) | |
92 | + | then throw("#002 dApp has not started yet") | |
93 | + | else if (hasEnded()) | |
94 | + | then throw("#003 dApp already completed") | |
95 | + | else if ((addressSecurityTokens == 0)) | |
96 | + | then throw("#005 This account does not have dividends to recieve.") | |
97 | + | else if ((addressPaid == true)) | |
98 | + | then throw("#006 This account has already received dividends.") | |
99 | + | else { | |
100 | + | let coefficient = getAmount(coefficientKey) | |
101 | + | let amount = fraction(addressSecurityTokens, coefficient, securityAssetDecimalsOffset) | |
102 | + | ScriptResult(WriteSet([DataEntry(addressPaidKey, true), DataEntry(addressPaidAmountKey, amount)]), TransferSet([ScriptTransfer(currentKeyAddress, amount, dividendsAssetIdForTransfer)])) | |
103 | + | } | |
104 | + | } | |
105 | + | ||
106 | + | ||
107 | + | @Verifier(tx) | |
108 | + | func verify () = match tx { | |
109 | + | case tx: SetScriptTransaction => | |
110 | + | let txId = toBase58String(tx.id) | |
111 | + | let pAddress1 = getAddressFromBook("pAddress1") | |
112 | + | let pAddress2 = getAddressFromBook("pAddress2") | |
113 | + | let pAddress3 = getAddressFromBook("pAddress3") | |
114 | + | let pAddress4 = getAddressFromBook("pAddress4") | |
115 | + | let pAddress5 = getAddressFromBook("pAddress5") | |
116 | + | let pAddress6 = getAddressFromBook("pAddress6") | |
117 | + | let pAddress7 = getAddressFromBook("pAddress7") | |
118 | + | let pAddress8 = getAddressFromBook("pAddress8") | |
119 | + | let pKey1Signed = if (isDefined(getInteger(pAddress1, txId))) | |
120 | + | then 1 | |
121 | + | else 0 | |
122 | + | let pKey2Signed = if (isDefined(getInteger(pAddress2, txId))) | |
123 | + | then 1 | |
124 | + | else 0 | |
125 | + | let pKey3Signed = if (isDefined(getInteger(pAddress3, txId))) | |
126 | + | then 1 | |
127 | + | else 0 | |
128 | + | let pKey4Signed = if (isDefined(getInteger(pAddress4, txId))) | |
129 | + | then 1 | |
130 | + | else 0 | |
131 | + | let pKey5Signed = if (isDefined(getInteger(pAddress5, txId))) | |
132 | + | then 1 | |
133 | + | else 0 | |
134 | + | let pKey6Signed = if (isDefined(getInteger(pAddress6, txId))) | |
135 | + | then 1 | |
136 | + | else 0 | |
137 | + | let pKey7Signed = if (isDefined(getInteger(pAddress7, txId))) | |
138 | + | then 1 | |
139 | + | else 0 | |
140 | + | let pKey8Signed = if (isDefined(getInteger(pAddress8, txId))) | |
141 | + | then 1 | |
142 | + | else 0 | |
143 | + | ((((((((pKey1Signed + pKey2Signed) + pKey3Signed) + pKey4Signed) + pKey5Signed) + pKey6Signed) + pKey7Signed) + pKey8Signed) >= 3) | |
144 | + | case _ => | |
145 | + | false | |
146 | + | } | |
147 | + |
github/deemru/w8io/169f3d6 17.26 ms ◑