tx · 6pGZUTAuz2kEP3p2o88RkFqMHtq8qVpCujCkFUWGwMLJ 3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k: -0.01000000 Waves 2023.01.13 09:22 [2402806] smart account 3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k > SELF 0.00000000 Waves
{ "type": 13, "id": "6pGZUTAuz2kEP3p2o88RkFqMHtq8qVpCujCkFUWGwMLJ", "fee": 1000000, "feeAssetId": null, "timestamp": 1673590986166, "version": 2, "chainId": 84, "sender": "3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k", "senderPublicKey": "3VyXNqJY8HwfqLo6TUZ1V4BwE6NMZuq9XYEARYhktMPE", "proofs": [ "3o7tmx2Y3QL72242dqQc7PELpa4WUDzn4M52dBUdSRtMGtq5YGd8mA175ia3MtqSjJUmkdhsiiAAqwgBmeYUskuS" ], "script": "base64:BgIZCAISBAoCCAgSBAoCCAESBAoCCAESAwoBCAYBDmdldFN0cmluZ0J5S2V5AQNrZXkJAQt2YWx1ZU9yRWxzZQIJAJ0IAgUEdGhpcwUDa2V5AgABD2dldEludGVnZXJCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFA2tleQAAAAtDT05GX0FNSU5fSwINQURNSU5fQUREUkVTUwAPQ09ORl9BUlRXT1JLU19LAg1BUlRXT1JLU19EQVBQAAVjaHJpcwkBDmdldFN0cmluZ0J5S2V5AQULQ09ORl9BTUlOX0sADGFydHdvcmtzRGFwcAkBDmdldFN0cmluZ0J5S2V5AQUPQ09ORl9BUlRXT1JLU19LBAZpbnZva2UBB3NldENvbmYCA2tleQN2YWwEBmNhbGxlcgkApQgBCAUGaW52b2tlBmNhbGxlcgMJAQ9jb250YWluc0VsZW1lbnQCCQDMCAIFBWNocmlzCQDMCAIJAKUIAQUEdGhpcwUDbmlsBQZjYWxsZXIJAMwIAgkBC1N0cmluZ0VudHJ5AgUDa2V5BQN2YWwFA25pbAkAAgECIllvdSBhcmUg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MYXJ0d29ya3NEYXBwBQNuaWwFBmNhbGxlcgkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQdhZGRyZXNzAgtfZnJlZV9kcm9wcwkAZQIFBmFtb3VudAABBQNuaWwJAAIBAitZb3UgYXJlIG5vdCBhdXRob3JpemVkIHRvIHdoaXRlbGlzdCBhcnRpc3RzALSD8bk=", "height": 2402806, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ADN2rsdDTYnv8EzGsukVpwNfhzUicweaZn44QQdvMDQ3 Next: EF5UUj83ozzbkpEC4TLHZEstiRbUdwnCY2PJ49WV6JeV Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
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 | - | let joep = "3Mzm4VLwsN9uZwbTMzPj3XuxV6kEfAR8UDN" | |
6 | + | ||
7 | + | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
8 | + | ||
9 | + | ||
10 | + | let CONF_AMIN_K = "ADMIN_ADDRESS" | |
11 | + | ||
12 | + | let CONF_ARTWORKS_K = "ARTWORKS_DAPP" | |
13 | + | ||
14 | + | let chris = getStringByKey(CONF_AMIN_K) | |
15 | + | ||
16 | + | let artworksDapp = getStringByKey(CONF_ARTWORKS_K) | |
17 | + | ||
18 | + | @Callable(invoke) | |
19 | + | func setConf (key,val) = { | |
20 | + | let caller = toString(invoke.caller) | |
21 | + | if (containsElement([chris, toString(this)], caller)) | |
22 | + | then [StringEntry(key, val)] | |
23 | + | else throw("You are not allowed to change this") | |
24 | + | } | |
25 | + | ||
26 | + | ||
7 | 27 | ||
8 | 28 | @Callable(i) | |
9 | 29 | func whitelist (address,days) = { | |
12 | 32 | let expire = if ((days == 0)) | |
13 | 33 | then days | |
14 | 34 | else (height + (1440 * days)) | |
15 | - | if (containsElement([chris | |
35 | + | if (containsElement([chris], caller)) | |
16 | 36 | then [IntegerEntry(address, expire)] | |
17 | 37 | else throw("You are not authorized to whitelist artists") | |
38 | + | } | |
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | @Callable(i) | |
43 | + | func whitelistFreeDrop (address,amount) = { | |
44 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
45 | + | let id = toBase58String(i.transactionId) | |
46 | + | if (containsElement([chris], caller)) | |
47 | + | then [IntegerEntry((address + "_free_drops"), amount)] | |
48 | + | else throw("You are not authorized to whitelist artists") | |
49 | + | } | |
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | @Callable(i) | |
54 | + | func useFreeDrop (address) = { | |
55 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
56 | + | let amount = valueOrElse(getInteger(this, (address + "_free_drops")), 0) | |
57 | + | if ((0 >= amount)) | |
58 | + | then throw("No free drop available") | |
59 | + | else { | |
60 | + | let id = toBase58String(i.transactionId) | |
61 | + | if (containsElement([chris, artworksDapp], caller)) | |
62 | + | then [IntegerEntry((address + "_free_drops"), (amount - 1))] | |
63 | + | else throw("You are not authorized to whitelist artists") | |
64 | + | } | |
18 | 65 | } | |
19 | 66 | ||
20 | 67 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
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 | - | let joep = "3Mzm4VLwsN9uZwbTMzPj3XuxV6kEfAR8UDN" | |
6 | + | ||
7 | + | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
8 | + | ||
9 | + | ||
10 | + | let CONF_AMIN_K = "ADMIN_ADDRESS" | |
11 | + | ||
12 | + | let CONF_ARTWORKS_K = "ARTWORKS_DAPP" | |
13 | + | ||
14 | + | let chris = getStringByKey(CONF_AMIN_K) | |
15 | + | ||
16 | + | let artworksDapp = getStringByKey(CONF_ARTWORKS_K) | |
17 | + | ||
18 | + | @Callable(invoke) | |
19 | + | func setConf (key,val) = { | |
20 | + | let caller = toString(invoke.caller) | |
21 | + | if (containsElement([chris, toString(this)], caller)) | |
22 | + | then [StringEntry(key, val)] | |
23 | + | else throw("You are not allowed to change this") | |
24 | + | } | |
25 | + | ||
26 | + | ||
7 | 27 | ||
8 | 28 | @Callable(i) | |
9 | 29 | func whitelist (address,days) = { | |
10 | 30 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
11 | 31 | let id = toBase58String(i.transactionId) | |
12 | 32 | let expire = if ((days == 0)) | |
13 | 33 | then days | |
14 | 34 | else (height + (1440 * days)) | |
15 | - | if (containsElement([chris | |
35 | + | if (containsElement([chris], caller)) | |
16 | 36 | then [IntegerEntry(address, expire)] | |
17 | 37 | else throw("You are not authorized to whitelist artists") | |
38 | + | } | |
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | @Callable(i) | |
43 | + | func whitelistFreeDrop (address,amount) = { | |
44 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
45 | + | let id = toBase58String(i.transactionId) | |
46 | + | if (containsElement([chris], caller)) | |
47 | + | then [IntegerEntry((address + "_free_drops"), amount)] | |
48 | + | else throw("You are not authorized to whitelist artists") | |
49 | + | } | |
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | @Callable(i) | |
54 | + | func useFreeDrop (address) = { | |
55 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
56 | + | let amount = valueOrElse(getInteger(this, (address + "_free_drops")), 0) | |
57 | + | if ((0 >= amount)) | |
58 | + | then throw("No free drop available") | |
59 | + | else { | |
60 | + | let id = toBase58String(i.transactionId) | |
61 | + | if (containsElement([chris, artworksDapp], caller)) | |
62 | + | then [IntegerEntry((address + "_free_drops"), (amount - 1))] | |
63 | + | else throw("You are not authorized to whitelist artists") | |
64 | + | } | |
18 | 65 | } | |
19 | 66 | ||
20 | 67 |
github/deemru/w8io/169f3d6 46.07 ms ◑