tx · HR6G9oMDfJtMSmWCghPZBR54E2DkwneAFyuLD4W3aSvU

3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9:  -0.01400000 Waves

2019.07.04 00:38 [569790] smart account 3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9 > SELF 0.00000000 Waves

{ "type": 13, "id": "HR6G9oMDfJtMSmWCghPZBR54E2DkwneAFyuLD4W3aSvU", "fee": 1400000, "feeAssetId": null, "timestamp": 1562189933073, "version": 1, "sender": "3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9", "senderPublicKey": "2kKaoCcJJ7XyWXm1bKS64QdpwGQpmaEcrToYuPd1k2nB", "proofs": [ "3Qdu1SLhJBWjd1abwKiCx6uoPXnZhw57WvxBv3Re2zuSHG8whcHyU5g2qQC7xkmpg6v6g5BNCVspJXnQgM9GDD9" ], "script": "base64:AAIDAAAAAAAAAAAAAAAOAAAAAAtCTEFDS0xJU1RFRAIAAAAJYmxhY2tsaXN0AAAAAAROT05FAgAAAARub25lAAAAAAh2ZXJpZmllcgIAAAAjM041eWhaYW90QkxVR0oxRWVlZ1QyS0MzaVRkaEFhbWNISjkAAAAACFZFUklGSUVEAgAAAAh2ZXJpZmllZAEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAAOZ2V0S2V5SXRlbURhdGEAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAFX2RhdGEBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfb3duZXIBAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAA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AAAAACBQAAABFzdXBwbGllcldoaXRlTGlzdAUAAAALQkxBQ0tMSVNURUQJAAACAAAAAQIAAAAnc3VwcGxpZXIncyBhY2NvdW50IGhhcyBiZWVuIGJsYWNrbGlzdGVkCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAPc3VwcGxpZXJBZGRyZXNzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQUAAAAEaXRlbQUAAAAFcHJpY2UJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAA5nZXRLZXlJdGVtRGF0YQAAAAEFAAAABGl0ZW0FAAAABGRhdGEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABxnZXRFeHRLZXlJdGVtV2hpdGVMaXN0U3RhdHVzAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzBQAAABFzdXBwbGllcldoaXRlTGlzdAUAAAADbmlsAAAAABsgoNc=", "chainId": 84, "height": 569790, "spentComplexity": 0 } View: original | compacted Prev: BC8QvNBEjfnmSJZxmbbb8qpBYCwY19GEnTgaoUCxKv9m Next: none Diff:
OldNewDifferences
44 let BLACKLISTED = "blacklist"
55
66 let NONE = "none"
7+
8+let verifier = "3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9"
9+
10+let VERIFIED = "verified"
711
812 func getKeyItemPrice (item) = (item + "_price")
913
4852 }
4953
5054
55+func getValueItemWhiteListStatus (item) = (item + "_verifier_status")
56+
57+
58+@Callable(i)
59+func setstatus (supplier,status) = {
60+ let account = toBase58String(i.caller.bytes)
61+ if ((account != verifier))
62+ then throw("only oracle verifier are able to manage whitelist")
63+ else if (if ((status != VERIFIED))
64+ then (status != BLACKLISTED)
65+ else false)
66+ then throw("wrong status")
67+ else WriteSet([DataEntry(getValueItemWhiteListStatus(supplier), status)])
68+ }
69+
70+
71+
5172 @Callable(i)
5273 func addItem (title,price,data) = {
5374 let supplierAddress = toBase58String(i.caller.bytes)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let BLACKLISTED = "blacklist"
55
66 let NONE = "none"
7+
8+let verifier = "3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9"
9+
10+let VERIFIED = "verified"
711
812 func getKeyItemPrice (item) = (item + "_price")
913
1014
1115 func getKeyItemData (item) = (item + "_data")
1216
1317
1418 func getKeyItemSupplier (item) = (item + "_owner")
1519
1620
1721 func getStrByKey (key) = {
1822 let str = match getString(this, key) {
1923 case a: String =>
2024 a
2125 case _ =>
2226 NONE
2327 }
2428 str
2529 }
2630
2731
2832 func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
2933
3034
3135 func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
3236
3337
3438 func getExtAddressOracle () = extract(addressFromString("3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9"))
3539
3640
3741 func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status")
3842
3943
4044 func getExtValueItemWhiteListStatus (oracle,account) = {
4145 let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) {
4246 case a: String =>
4347 a
4448 case _ =>
4549 NONE
4650 }
4751 str
4852 }
4953
5054
55+func getValueItemWhiteListStatus (item) = (item + "_verifier_status")
56+
57+
58+@Callable(i)
59+func setstatus (supplier,status) = {
60+ let account = toBase58String(i.caller.bytes)
61+ if ((account != verifier))
62+ then throw("only oracle verifier are able to manage whitelist")
63+ else if (if ((status != VERIFIED))
64+ then (status != BLACKLISTED)
65+ else false)
66+ then throw("wrong status")
67+ else WriteSet([DataEntry(getValueItemWhiteListStatus(supplier), status)])
68+ }
69+
70+
71+
5172 @Callable(i)
5273 func addItem (title,price,data) = {
5374 let supplierAddress = toBase58String(i.caller.bytes)
5475 let item = getKeyItem(supplierAddress, title)
5576 let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress)
5677 if ((0 >= price))
5778 then throw("purchase amount cannot be less than item price")
5879 else if ((getValueItemSupplier(item) != NONE))
5980 then throw("an item already exists")
6081 else if ((supplierWhiteList == BLACKLISTED))
6182 then throw("supplier's account has been blacklisted")
6283 else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierWhiteList)])
6384 }
6485
6586

github/deemru/w8io/169f3d6 
29.51 ms