tx · H5PgdiwCkSLydxh4mDKhpNAiYxiXFLmwAQJae2kESam7 3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k: -0.01000000 Waves 2023.01.19 06:03 [2411248] smart account 3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k > SELF 0.00000000 Waves
{ "type": 13, "id": "H5PgdiwCkSLydxh4mDKhpNAiYxiXFLmwAQJae2kESam7", "fee": 1000000, "feeAssetId": null, "timestamp": 1674097475227, "version": 2, "chainId": 84, "sender": "3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k", "senderPublicKey": "3VyXNqJY8HwfqLo6TUZ1V4BwE6NMZuq9XYEARYhktMPE", "proofs": [ "3rE9HMUbRM39wrRdjmrPCJf1HuLeY4R6PLnbyriwESoAq83NGsb8bRF2ZUoGZ24Ltv8CsY7yTi4ByhhBZM3avMCg" ], "script": "base64:BgIaCAISBAoCCAgSBAoCCAESBQoDCAEEEgMKAQgGAQ5nZXRTdHJpbmdCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCdCAIFBHRoaXMFA2tleQIAAQ9nZXRJbnRlZ2VyQnlLZXkBA2tleQkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQNrZXkAAAALQ09ORl9BTUlOX0sCDUFETUlOX0FERFJFU1MAD0NPTkZfQVJUV09SS1NfSwINQVJUV09SS1NfREFQUAAFY2hyaXMJAQ5nZXRTdHJpbmdCeUtleQEFC0NPTkZfQU1JTl9LAAxhcnR3b3Jrc0RhcHAJAQ5nZXRTdHJpbmdCeUtleQEFD0NPTkZfQVJUV09SS1NfSwQGaW52b2tlAQdzZXRDb25mAgNrZXkDdmFsBAZjYWxsZXIJAKUIAQgFBmludm9rZQZjYWxsZXIDCQEPY29udGFpbnNFbGVtZW50AgkAzAgCBQVjaHJpcwkAzAgCCQClCAEFBHRoaXMFA25pbAUGY2FsbGVyCQDMCAIJAQtTdHJpbmdFbnRyeQIFA2tleQUDdmFsBQNuaWwJAAIBAi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dmFsdWVPckVsc2UCCQCaCAIFBHRoaXMJAKwCAgUHYWRkcmVzcwILX2ZyZWVfZHJvcHMAAAMJAGcCAAAFBmFtb3VudAkAAgECFk5vIGZyZWUgZHJvcCBhdmFpbGFibGUEAmlkCQDYBAEIBQFpDXRyYW5zYWN0aW9uSWQDCQEPY29udGFpbnNFbGVtZW50AgkAzAgCBQVjaHJpcwkAzAgCBQxhcnR3b3Jrc0RhcHAFA25pbAUGY2FsbGVyCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIFB2FkZHJlc3MCC19mcmVlX2Ryb3BzCQBlAgUGYW1vdW50AAEFA25pbAkAAgECIVlvdSBhcmUgbm90IGF1dGhvcml6ZWQgdG8gZG8gdGhpcwAU5AYw", "height": 2411248, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EF5UUj83ozzbkpEC4TLHZEstiRbUdwnCY2PJ49WV6JeV Next: HQCZJH8Za2AbcDXAh6vfbYEiW3SrPiJS9uRoyu7ZeXie Diff:
Old | New | Differences | |
---|---|---|---|
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(i) | |
43 | - | func whitelistFreeDrop (address,amount) = { | |
43 | + | func whitelistFreeDrop (address,amount,addToCurrentAmount) = { | |
44 | 44 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
45 | 45 | let id = toBase58String(i.transactionId) | |
46 | 46 | if (containsElement([chris], caller)) | |
47 | - | then [IntegerEntry((address + "_free_drops"), amount)] | |
48 | - | else throw("You are not authorized to whitelist artists") | |
47 | + | then { | |
48 | + | let currentAmount = valueOrElse(getInteger(this, (address + "_free_drops")), 0) | |
49 | + | let newAmount = if (addToCurrentAmount) | |
50 | + | then (currentAmount + amount) | |
51 | + | else amount | |
52 | + | [IntegerEntry((address + "_free_drops"), newAmount)] | |
53 | + | } | |
54 | + | else throw("You are not authorized to whitelist drops") | |
49 | 55 | } | |
50 | 56 | ||
51 | 57 | ||
60 | 66 | let id = toBase58String(i.transactionId) | |
61 | 67 | if (containsElement([chris, artworksDapp], caller)) | |
62 | 68 | then [IntegerEntry((address + "_free_drops"), (amount - 1))] | |
63 | - | else throw("You are not authorized to | |
69 | + | else throw("You are not authorized to do this") | |
64 | 70 | } | |
65 | 71 | } | |
66 | 72 |
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 | 14 | let chris = getStringByKey(CONF_AMIN_K) | |
15 | 15 | ||
16 | 16 | let artworksDapp = getStringByKey(CONF_ARTWORKS_K) | |
17 | 17 | ||
18 | 18 | @Callable(invoke) | |
19 | 19 | func setConf (key,val) = { | |
20 | 20 | let caller = toString(invoke.caller) | |
21 | 21 | if (containsElement([chris, toString(this)], caller)) | |
22 | 22 | then [StringEntry(key, val)] | |
23 | 23 | else throw("You are not allowed to change this") | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | ||
28 | 28 | @Callable(i) | |
29 | 29 | func whitelist (address,days) = { | |
30 | 30 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
31 | 31 | let id = toBase58String(i.transactionId) | |
32 | 32 | let expire = if ((days == 0)) | |
33 | 33 | then days | |
34 | 34 | else (height + (1440 * days)) | |
35 | 35 | if (containsElement([chris], caller)) | |
36 | 36 | then [IntegerEntry(address, expire)] | |
37 | 37 | else throw("You are not authorized to whitelist artists") | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(i) | |
43 | - | func whitelistFreeDrop (address,amount) = { | |
43 | + | func whitelistFreeDrop (address,amount,addToCurrentAmount) = { | |
44 | 44 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
45 | 45 | let id = toBase58String(i.transactionId) | |
46 | 46 | if (containsElement([chris], caller)) | |
47 | - | then [IntegerEntry((address + "_free_drops"), amount)] | |
48 | - | else throw("You are not authorized to whitelist artists") | |
47 | + | then { | |
48 | + | let currentAmount = valueOrElse(getInteger(this, (address + "_free_drops")), 0) | |
49 | + | let newAmount = if (addToCurrentAmount) | |
50 | + | then (currentAmount + amount) | |
51 | + | else amount | |
52 | + | [IntegerEntry((address + "_free_drops"), newAmount)] | |
53 | + | } | |
54 | + | else throw("You are not authorized to whitelist drops") | |
49 | 55 | } | |
50 | 56 | ||
51 | 57 | ||
52 | 58 | ||
53 | 59 | @Callable(i) | |
54 | 60 | func useFreeDrop (address) = { | |
55 | 61 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
56 | 62 | let amount = valueOrElse(getInteger(this, (address + "_free_drops")), 0) | |
57 | 63 | if ((0 >= amount)) | |
58 | 64 | then throw("No free drop available") | |
59 | 65 | else { | |
60 | 66 | let id = toBase58String(i.transactionId) | |
61 | 67 | if (containsElement([chris, artworksDapp], caller)) | |
62 | 68 | then [IntegerEntry((address + "_free_drops"), (amount - 1))] | |
63 | - | else throw("You are not authorized to | |
69 | + | else throw("You are not authorized to do this") | |
64 | 70 | } | |
65 | 71 | } | |
66 | 72 | ||
67 | 73 |
github/deemru/w8io/169f3d6 28.82 ms ◑