tx · HQCZJH8Za2AbcDXAh6vfbYEiW3SrPiJS9uRoyu7ZeXie 3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k: -0.01000000 Waves 2023.01.19 08:00 [2411368] smart account 3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k > SELF 0.00000000 Waves
{ "type": 13, "id": "HQCZJH8Za2AbcDXAh6vfbYEiW3SrPiJS9uRoyu7ZeXie", "fee": 1000000, "feeAssetId": null, "timestamp": 1674104504225, "version": 2, "chainId": 84, "sender": "3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k", "senderPublicKey": "3VyXNqJY8HwfqLo6TUZ1V4BwE6NMZuq9XYEARYhktMPE", "proofs": [ "2KGb8YnyUcMuxfUtgosGTm9qkp5hjn1AZK7eSBcqKiWE5Zax8PEcw8XZG5AaGmu9gZfbK5QSeztrxeioZA4Ktvdv" ], "script": "base64:BgImCAISBAoCCAgSBAoCCAESBQoDCAEEEgMKAQgSBQoDCAEEEgMKAQgIAQ5nZXRTdHJpbmdCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCdCAIFBHRoaXMFA2tleQIAAQ9nZXRJbnRlZ2VyQnlLZXkBA2tleQkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQNrZXkAAAALQ09ORl9BTUlOX0sCDUFETUlOX0FERFJFU1MAD0NPTkZfQVJUV09SS1NfSwINQVJUV09SS1NfREFQUAAMQ09ORl9VU0VSU19LAgpVU0VSU19EQVBQAAVjaHJpcwkBDmdldFN0cmluZ0J5S2V5AQULQ09ORl9BTUlOX0sADGFydHdvcmtzRGFwcAkBDmdldFN0cmluZ0J5S2V5AQUPQ09ORl9BUlRXT1JLU19LAAl1c2Vyc0RhcHAJAQ5nZXRTdHJpbmdCeUtleQEFDENPTkZfVVNFUlNfSwYGaW52b2tlAQdzZXRDb25mAgNrZXkDdmFsBAZjYWxsZXIJAKUIAQgFBmludm9rZQZjYWxsZXIDCQEPY29udGFpbnNFbGVtZW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CQClCAEJAKcIAQgFAWkPY2FsbGVyUHVibGljS2V5BAZhbW91bnQJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwkArAICBQdhZGRyZXNzAglfZnJlZV90eHMAAAMJAGcCAAAFBmFtb3VudAkAAgECFE5vIGZyZWUgdHggYXZhaWxhYmxlBAJpZAkA2AQBCAUBaQ10cmFuc2FjdGlvbklkAwkBD2NvbnRhaW5zRWxlbWVudAIJAMwIAgUMYXJ0d29ya3NEYXBwCQDMCAIFCXVzZXJzRGFwcAUDbmlsBQZjYWxsZXIJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgUHYWRkcmVzcwIJX2ZyZWVfdHhzCQBlAgUGYW1vdW50AAEJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBB0FkZHJlc3MBCQDZBAEFBmNhbGxlcgCgwh4FBHVuaXQFA25pbAkAAgECIVlvdSBhcmUgbm90IGF1dGhvcml6ZWQgdG8gZG8gdGhpcwAMiSNc", "height": 2411368, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: H5PgdiwCkSLydxh4mDKhpNAiYxiXFLmwAQJae2kESam7 Next: BLUucQ6YZ6x2kDcFNYQu96ikhXDe8zoGwChZcvCazkXh Diff:
Old | New | Differences | |
---|---|---|---|
11 | 11 | ||
12 | 12 | let CONF_ARTWORKS_K = "ARTWORKS_DAPP" | |
13 | 13 | ||
14 | + | let CONF_USERS_K = "USERS_DAPP" | |
15 | + | ||
14 | 16 | let chris = getStringByKey(CONF_AMIN_K) | |
15 | 17 | ||
16 | 18 | let artworksDapp = getStringByKey(CONF_ARTWORKS_K) | |
19 | + | ||
20 | + | let usersDapp = getStringByKey(CONF_USERS_K) | |
17 | 21 | ||
18 | 22 | @Callable(invoke) | |
19 | 23 | func setConf (key,val) = { | |
64 | 68 | then throw("No free drop available") | |
65 | 69 | else { | |
66 | 70 | let id = toBase58String(i.transactionId) | |
67 | - | if (containsElement([ | |
71 | + | if (containsElement([artworksDapp], caller)) | |
68 | 72 | then [IntegerEntry((address + "_free_drops"), (amount - 1))] | |
73 | + | else throw("You are not authorized to do this") | |
74 | + | } | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | @Callable(i) | |
80 | + | func whitelistFreeTxs (address,amount,addToCurrentAmount) = { | |
81 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
82 | + | let id = toBase58String(i.transactionId) | |
83 | + | if (containsElement([chris], caller)) | |
84 | + | then { | |
85 | + | let currentAmount = valueOrElse(getInteger(this, (address + "_free_txq")), 0) | |
86 | + | let newAmount = if (addToCurrentAmount) | |
87 | + | then (currentAmount + amount) | |
88 | + | else amount | |
89 | + | [IntegerEntry((address + "_free_txs"), newAmount)] | |
90 | + | } | |
91 | + | else throw("You are not authorized to whitelist txs") | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | @Callable(i) | |
97 | + | func useFreeTx (address) = { | |
98 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
99 | + | let amount = valueOrElse(getInteger(this, (address + "_free_txs")), 0) | |
100 | + | if ((0 >= amount)) | |
101 | + | then throw("No free tx available") | |
102 | + | else { | |
103 | + | let id = toBase58String(i.transactionId) | |
104 | + | if (containsElement([artworksDapp, usersDapp], caller)) | |
105 | + | then [IntegerEntry((address + "_free_txs"), (amount - 1)), ScriptTransfer(Address(fromBase58String(caller)), 500000, unit)] | |
69 | 106 | else throw("You are not authorized to do this") | |
70 | 107 | } | |
71 | 108 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | let CONF_AMIN_K = "ADMIN_ADDRESS" | |
11 | 11 | ||
12 | 12 | let CONF_ARTWORKS_K = "ARTWORKS_DAPP" | |
13 | 13 | ||
14 | + | let CONF_USERS_K = "USERS_DAPP" | |
15 | + | ||
14 | 16 | let chris = getStringByKey(CONF_AMIN_K) | |
15 | 17 | ||
16 | 18 | let artworksDapp = getStringByKey(CONF_ARTWORKS_K) | |
19 | + | ||
20 | + | let usersDapp = getStringByKey(CONF_USERS_K) | |
17 | 21 | ||
18 | 22 | @Callable(invoke) | |
19 | 23 | func setConf (key,val) = { | |
20 | 24 | let caller = toString(invoke.caller) | |
21 | 25 | if (containsElement([chris, toString(this)], caller)) | |
22 | 26 | then [StringEntry(key, val)] | |
23 | 27 | else throw("You are not allowed to change this") | |
24 | 28 | } | |
25 | 29 | ||
26 | 30 | ||
27 | 31 | ||
28 | 32 | @Callable(i) | |
29 | 33 | func whitelist (address,days) = { | |
30 | 34 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
31 | 35 | let id = toBase58String(i.transactionId) | |
32 | 36 | let expire = if ((days == 0)) | |
33 | 37 | then days | |
34 | 38 | else (height + (1440 * days)) | |
35 | 39 | if (containsElement([chris], caller)) | |
36 | 40 | then [IntegerEntry(address, expire)] | |
37 | 41 | else throw("You are not authorized to whitelist artists") | |
38 | 42 | } | |
39 | 43 | ||
40 | 44 | ||
41 | 45 | ||
42 | 46 | @Callable(i) | |
43 | 47 | func whitelistFreeDrop (address,amount,addToCurrentAmount) = { | |
44 | 48 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
45 | 49 | let id = toBase58String(i.transactionId) | |
46 | 50 | if (containsElement([chris], caller)) | |
47 | 51 | then { | |
48 | 52 | let currentAmount = valueOrElse(getInteger(this, (address + "_free_drops")), 0) | |
49 | 53 | let newAmount = if (addToCurrentAmount) | |
50 | 54 | then (currentAmount + amount) | |
51 | 55 | else amount | |
52 | 56 | [IntegerEntry((address + "_free_drops"), newAmount)] | |
53 | 57 | } | |
54 | 58 | else throw("You are not authorized to whitelist drops") | |
55 | 59 | } | |
56 | 60 | ||
57 | 61 | ||
58 | 62 | ||
59 | 63 | @Callable(i) | |
60 | 64 | func useFreeDrop (address) = { | |
61 | 65 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
62 | 66 | let amount = valueOrElse(getInteger(this, (address + "_free_drops")), 0) | |
63 | 67 | if ((0 >= amount)) | |
64 | 68 | then throw("No free drop available") | |
65 | 69 | else { | |
66 | 70 | let id = toBase58String(i.transactionId) | |
67 | - | if (containsElement([ | |
71 | + | if (containsElement([artworksDapp], caller)) | |
68 | 72 | then [IntegerEntry((address + "_free_drops"), (amount - 1))] | |
73 | + | else throw("You are not authorized to do this") | |
74 | + | } | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | @Callable(i) | |
80 | + | func whitelistFreeTxs (address,amount,addToCurrentAmount) = { | |
81 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
82 | + | let id = toBase58String(i.transactionId) | |
83 | + | if (containsElement([chris], caller)) | |
84 | + | then { | |
85 | + | let currentAmount = valueOrElse(getInteger(this, (address + "_free_txq")), 0) | |
86 | + | let newAmount = if (addToCurrentAmount) | |
87 | + | then (currentAmount + amount) | |
88 | + | else amount | |
89 | + | [IntegerEntry((address + "_free_txs"), newAmount)] | |
90 | + | } | |
91 | + | else throw("You are not authorized to whitelist txs") | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | @Callable(i) | |
97 | + | func useFreeTx (address) = { | |
98 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
99 | + | let amount = valueOrElse(getInteger(this, (address + "_free_txs")), 0) | |
100 | + | if ((0 >= amount)) | |
101 | + | then throw("No free tx available") | |
102 | + | else { | |
103 | + | let id = toBase58String(i.transactionId) | |
104 | + | if (containsElement([artworksDapp, usersDapp], caller)) | |
105 | + | then [IntegerEntry((address + "_free_txs"), (amount - 1)), ScriptTransfer(Address(fromBase58String(caller)), 500000, unit)] | |
69 | 106 | else throw("You are not authorized to do this") | |
70 | 107 | } | |
71 | 108 | } | |
72 | 109 | ||
73 | 110 |
github/deemru/w8io/169f3d6 26.53 ms ◑