tx · 5HSAynpX34bVAgatGQYo2xTC4BH9AoZaSSjRRj63ua1F 3N1QMARzVToYmhwJJ5fmCcKSgKCH6BDXTEJ: -0.01400000 Waves 2019.07.03 10:29 [568934] smart account 3N1QMARzVToYmhwJJ5fmCcKSgKCH6BDXTEJ > SELF 0.00000000 Waves
{ "type": 13, "id": "5HSAynpX34bVAgatGQYo2xTC4BH9AoZaSSjRRj63ua1F", "fee": 1400000, "feeAssetId": null, "timestamp": 1562138943379, "version": 1, "sender": "3N1QMARzVToYmhwJJ5fmCcKSgKCH6BDXTEJ", "senderPublicKey": "6dbd5gpHc5xPFGwGpp9oJVpjHboa9to1zKAC3zR89UH8", "proofs": [ "3FicSt3H7aUFj2s98VC4nQtNT1V34hvSGRyagHoNr9Tr4mrsNqg9Q4jdrHAvwrzgFRU84buXEY83emQNUrbpDaaZ" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAQAAAB5nZXRFeHRWYWx1ZUl0ZW1XaGl0ZUxpc3RTdGF0dXMAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAQX3ZlcmlzaWVyX3N0YXR1cwAAAAAIdmVyaWZpZXICAAAAIzNOMVFNQVJ6VlRvWW1od0pKNWZtQ2NLU2dLQ0g2QkRYVEVKAAAAAAhWRVJJRklFRAIAAAAIdmVyaWZpZWQAAAAAC0JMQUNLTElTVEVEAgAAAAlibGFja2xpc3QAAAABAAAAAWkBAAAACXNldHN0YXR1cwAAAAIAAAAIc3VwcGxpZXIAAAAGc3RhdHVzBAAAAAdhY2NvdW50CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMDCQEAAAACIT0AAAACBQAAAAdhY2NvdW50BQAAAAh2ZXJpZmllcgkAAAIAAAABAgAAADFvbmx5IG9yYWNsZSB2ZXJ5ZmllciBhcmUgYWJsZSB0byBtYW5hZ2Ugd2hpdGVsaXN0AwMJAQAAAAIhPQAAAAIFAAAABnN0YXR1cwUAAAAIVkVSSUZJRUQJAQAAAAIhPQAAAAIFAAAABnN0YXR1cwUAAAALQkxBQ0tMSVNURUQHCQAAAgAAAAECAAAADHdyb25nIHN0YXR1cwkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAHmdldEV4dFZhbHVlSXRlbVdoaXRlTGlzdFN0YXR1cwAAAAEFAAAACHN1cHBsaWVyBQAAAAZzdGF0dXMFAAAAA25pbAAAAACr87ZU", "chainId": 84, "height": 568934, "spentComplexity": 0 } View: original | compacted Prev: 4aQHumv3Vs6d3H8ptvkS3KmnzfYmEEbpoJgm1a6Sg7Ft Next: 7Cyq59zUw5oCtpQd91oRqx1jyorEX1GyJGEfsLftpsFw Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let NONE = "none" | |
5 | - | ||
6 | - | func getNumberByKey (key) = { | |
7 | - | let num = match getInteger(this, key) { | |
8 | - | case a: Int => | |
9 | - | a | |
10 | - | case _ => | |
11 | - | 0 | |
12 | - | } | |
13 | - | num | |
14 | - | } | |
4 | + | func getExtValueItemWhiteListStatus (item) = (item + "_verisier_status") | |
15 | 5 | ||
16 | 6 | ||
17 | - | func getStrByKey (key) = { | |
18 | - | let str = match getString(this, key) { | |
19 | - | case a: String => | |
20 | - | a | |
21 | - | case _ => | |
22 | - | NONE | |
23 | - | } | |
24 | - | str | |
25 | - | } | |
7 | + | let verifier = "3N1QMARzVToYmhwJJ5fmCcKSgKCH6BDXTEJ" | |
26 | 8 | ||
9 | + | let VERIFIED = "verified" | |
27 | 10 | ||
28 | - | func getKeyItemPrice (item) = (item + "_price") | |
29 | - | ||
30 | - | ||
31 | - | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
32 | - | ||
33 | - | ||
34 | - | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
35 | - | ||
36 | - | ||
37 | - | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
38 | - | ||
39 | - | ||
40 | - | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
41 | - | ||
42 | - | ||
43 | - | func getKeyItemData (item) = (item + "_data") | |
44 | - | ||
45 | - | ||
46 | - | func getKeyItemSupplier (item) = (item + "_owner") | |
47 | - | ||
48 | - | ||
49 | - | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
50 | - | ||
51 | - | ||
52 | - | func getKeyBalanceSupplier (account) = (account + "_balance") | |
53 | - | ||
54 | - | ||
55 | - | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
56 | - | ||
11 | + | let BLACKLISTED = "blacklist" | |
57 | 12 | ||
58 | 13 | @Callable(i) | |
59 | - | func addItem (title,price,data) = { | |
60 | - | let supplierAddress = toBase58String(i.caller.bytes) | |
61 | - | let item = getKeyItem(supplierAddress, title) | |
62 | - | if ((0 >= price)) | |
63 | - | then throw("purchase amount cannot be less than item price") | |
64 | - | else if ((getValueItemSupplier(item) != NONE)) | |
65 | - | then throw("an item is already exist") | |
66 | - | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
14 | + | func setstatus (supplier,status) = { | |
15 | + | let account = toBase58String(i.caller.bytes) | |
16 | + | if ((account != verifier)) | |
17 | + | then throw("only oracle veryfier are able to manage whitelist") | |
18 | + | else if (if ((status != VERIFIED)) | |
19 | + | then (status != BLACKLISTED) | |
20 | + | else false) | |
21 | + | then throw("wrong status") | |
22 | + | else WriteSet([DataEntry(getExtValueItemWhiteListStatus(supplier), status)]) | |
67 | 23 | } | |
68 | 24 | ||
69 | 25 |
github/deemru/w8io/169f3d6 38.95 ms ◑