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:BgIaCAISBAoCCAgSBAoCCAESBQoDCAEEEgMKAQgGAQ5nZXRTdHJpbmdCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCdCAIFBHRoaXMFA2tleQIAAQ9nZXRJbnRlZ2VyQnlLZXkBA2tleQkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQNrZXkAAAALQ09ORl9BTUlOX0sCDUFETUlOX0FERFJFU1MAD0NPTkZfQVJUV09SS1NfSwINQVJUV09SS1NfREFQUAAFY2hyaXMJAQ5nZXRTdHJpbmdCeUtleQEFC0NPTkZfQU1JTl9LAAxhcnR3b3Jrc0RhcHAJAQ5nZXRTdHJpbmdCeUtleQEFD0NPTkZfQVJUV09SS1NfSwQGaW52b2tlAQdzZXRDb25mAgNrZXkDdmFsBAZjYWxsZXIJAKUIAQgFBmludm9rZQZjYWxsZXIDCQEPY29udGFpbnNFbGVtZW50AgkAzAgCBQVjaHJpcwkAzAgCCQClCAEFBHRoaXMFA25pbAUGY2FsbGVyCQDMCAIJAQtTdHJpbmdFbnRyeQIFA2tleQUDdmFsBQNuaWwJAAIBA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ELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMJAKwCAgUHYWRkcmVzcwILX2ZyZWVfZHJvcHMAAAMJAGcCAAAFBmFtb3VudAkAAgECFk5vIGZyZWUgZHJvcCBhdmFpbGFibGUEAmlkCQDYBAEIBQFpDXRyYW5zYWN0aW9uSWQDCQEPY29udGFpbnNFbGVtZW50AgkAzAgCBQVjaHJpcwkAzAgCBQxhcnR3b3Jrc0RhcHAFA25pbAUGY2FsbGVyCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIFB2FkZHJlc3MCC19mcmVlX2Ryb3BzCQBlAgUGYW1vdW50AAEFA25pbAkAAgECIVlvdSBhcmUgbm90IGF1dGhvcml6ZWQgdG8gZG8gdGhpcwAU5AYw", "height": 2411248, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EF5UUj83ozzbkpEC4TLHZEstiRbUdwnCY2PJ49WV6JeV Next: HQCZJH8Za2AbcDXAh6vfbYEiW3SrPiJS9uRoyu7ZeXie Diff:
OldNewDifferences
4040
4141
4242 @Callable(i)
43-func whitelistFreeDrop (address,amount) = {
43+func whitelistFreeDrop (address,amount,addToCurrentAmount) = {
4444 let caller = toString(addressFromPublicKey(i.callerPublicKey))
4545 let id = toBase58String(i.transactionId)
4646 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")
4955 }
5056
5157
6066 let id = toBase58String(i.transactionId)
6167 if (containsElement([chris, artworksDapp], caller))
6268 then [IntegerEntry((address + "_free_drops"), (amount - 1))]
63- else throw("You are not authorized to whitelist artists")
69+ else throw("You are not authorized to do this")
6470 }
6571 }
6672
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getStringByKey (key) = valueOrElse(getString(this, key), "")
55
66
77 func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0)
88
99
1010 let CONF_AMIN_K = "ADMIN_ADDRESS"
1111
1212 let CONF_ARTWORKS_K = "ARTWORKS_DAPP"
1313
1414 let chris = getStringByKey(CONF_AMIN_K)
1515
1616 let artworksDapp = getStringByKey(CONF_ARTWORKS_K)
1717
1818 @Callable(invoke)
1919 func setConf (key,val) = {
2020 let caller = toString(invoke.caller)
2121 if (containsElement([chris, toString(this)], caller))
2222 then [StringEntry(key, val)]
2323 else throw("You are not allowed to change this")
2424 }
2525
2626
2727
2828 @Callable(i)
2929 func whitelist (address,days) = {
3030 let caller = toString(addressFromPublicKey(i.callerPublicKey))
3131 let id = toBase58String(i.transactionId)
3232 let expire = if ((days == 0))
3333 then days
3434 else (height + (1440 * days))
3535 if (containsElement([chris], caller))
3636 then [IntegerEntry(address, expire)]
3737 else throw("You are not authorized to whitelist artists")
3838 }
3939
4040
4141
4242 @Callable(i)
43-func whitelistFreeDrop (address,amount) = {
43+func whitelistFreeDrop (address,amount,addToCurrentAmount) = {
4444 let caller = toString(addressFromPublicKey(i.callerPublicKey))
4545 let id = toBase58String(i.transactionId)
4646 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")
4955 }
5056
5157
5258
5359 @Callable(i)
5460 func useFreeDrop (address) = {
5561 let caller = toString(addressFromPublicKey(i.callerPublicKey))
5662 let amount = valueOrElse(getInteger(this, (address + "_free_drops")), 0)
5763 if ((0 >= amount))
5864 then throw("No free drop available")
5965 else {
6066 let id = toBase58String(i.transactionId)
6167 if (containsElement([chris, artworksDapp], caller))
6268 then [IntegerEntry((address + "_free_drops"), (amount - 1))]
63- else throw("You are not authorized to whitelist artists")
69+ else throw("You are not authorized to do this")
6470 }
6571 }
6672
6773

github/deemru/w8io/169f3d6 
28.82 ms