tx · Fs9kakcWoFXzuG17nNKVB4ms5zN2xo5NaY6ppUqAYLva 3MrrbGfzfap6pDhQ4aozWbxwaiXFzjczHSm: -0.01000000 Waves 2020.06.08 13:46 [1034246] smart account 3MrrbGfzfap6pDhQ4aozWbxwaiXFzjczHSm > SELF 0.00000000 Waves
{ "type": 13, "id": "Fs9kakcWoFXzuG17nNKVB4ms5zN2xo5NaY6ppUqAYLva", "fee": 1000000, "feeAssetId": null, "timestamp": 1591613153662, "version": 1, "sender": "3MrrbGfzfap6pDhQ4aozWbxwaiXFzjczHSm", "senderPublicKey": "DtGWP5LUQbL6JAeNR4zA5pfLg1k3yH9q1rR11DtL5ndB", "proofs": [ "TnuK7sw5VgiVGBTyW29RUbk4WSjVXck9AoLtMm2RCisPXNiEcJ5kfFYZcJVAQ64y5DW7LuGjf939hwnzKVyKhcf" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAAFgAAAAALYWRkcmVzc0Jvb2sJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVRWgdR5NBM7vuJoxo7QLI34uXJ2wFdvAd4AAAAAE3doaXRlbGlzdEFkZHJlc3NLZXkCAAAAEHdoaXRlbGlzdEFkZHJlc3MAAAAAF2RBcHBXaGl0ZWxpc3RBZGRyZXNzS2V5AgAAABRkQXBwV2hpdGVsaXN0QWRkcmVzcwAAAAAOY29lZmZpY2llbnRLZXkCAAAAC2NvZWZmaWNpZW50AAAAABBkaXZpZGVuZHNBc3NldElkAQAAACCvOUhH768SCeA6PrRTnXQmq/k9bwVLiF0VD6knNWeEWAAAAAAVZGl2aWRlbmRzQXNzZXRJc1dhdmVzBwAAAAAbc2VjdXJpdHlBc3NldERlY2ltYWxzT2Zmc2V0AAAAAAAAAAAIAAAAAAlzdGFydFRpbWUAAAAAAF7qhFAAAAAAB2VuZFRpbWUAAAAAAGDLt9AAAAAAA3ZlcgIAAAAFNS4wLjEAAAAACnZhbGlkU3RhdGUAAAAAAAAAA+gAAAAADmdldEN1cnJlbn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M1NpZ25lZAUAAAALcEtleTRTaWduZWQFAAAAC3BLZXk1U2lnbmVkBQAAAAtwS2V5NlNpZ25lZAUAAAALcEtleTdTaWduZWQFAAAAC3BLZXk4U2lnbmVkAAAAAAAAAAADAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAnR4BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQctY0ho", "chainId": 84, "height": 1034246, "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'Co11Tbj83TeZCnuXrZQwv6Bs4XG2sm1vGQiQ4FLDjJWs' | |
13 | + | ||
14 | + | let dividendsAssetIsWaves = false | |
15 | + | ||
16 | + | let securityAssetDecimalsOffset = 8 | |
17 | + | ||
18 | + | let startTime = 1592427600 | |
19 | + | ||
20 | + | let endTime = 1623963600 | |
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 tx: DataTransaction => | |
145 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
146 | + | case _ => | |
147 | + | false | |
148 | + | } | |
149 | + |
github/deemru/w8io/169f3d6 24.31 ms ◑