tx · 8WqcH9xD83GMuNokv26xusSoRWSX7wMXCg87V5FbRysF 3NB5N2sZzeeXumQavrLSnySaDhLEtAjDhoj: -0.01400000 Waves 2019.11.07 21:50 [754895] smart account 3NB5N2sZzeeXumQavrLSnySaDhLEtAjDhoj > SELF 0.00000000 Waves
{ "type": 13, "id": "8WqcH9xD83GMuNokv26xusSoRWSX7wMXCg87V5FbRysF", "fee": 1400000, "feeAssetId": null, "timestamp": 1573152637869, "version": 1, "sender": "3NB5N2sZzeeXumQavrLSnySaDhLEtAjDhoj", "senderPublicKey": "J6uUrhmBcnvdu5KYxCr6uY5XoFb6bK1CdjWR8CMBst8o", "proofs": [ "4GL831j326VAxSS8iAaLagfaCDJwMFN6sDQc4GhvECL5bg6YfhWjA9ZFGwzD3yF3A59HyQhR3XoN4Qk7nZ6jfitA" ], "script": "base64:AAIDAAAAAAAAAAkIARIFCgMIAQgAAAAIAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAACmdldEtleUl0ZW0AAAACAAAACHN1cHBsaWVyAAAABXRpdGxlCQABLAAAAAICAAAABWl0ZW1fCQACWAAAAAEJAAH3AAAAAQkAAZsAAAABCQABLAAAAAIFAAAACHN1cHBsaWVyBQAAAAV0aXRsZQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAA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Z2V0S2V5SXRlbURhdGEAAAABBQAAAARpdGVtBQAAAARkYXRhBQAAAANuaWwAAAAAaX+QDQ==", "chainId": 84, "height": 754895, "spentComplexity": 0 } View: original | compacted Prev: CLMg4KtgZhDPggVkiiNMSt2f9F4pWhKhA93q4H9TVNru Next: 8p5SdUPviUe5yq4xJaokLxPLdj9KobLx6X3f9eXEyiTx 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 | + | } | |
15 | + | ||
16 | + | ||
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 | + | } | |
26 | + | ||
27 | + | ||
28 | + | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
29 | + | ||
30 | + | ||
31 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
32 | + | ||
33 | + | ||
34 | + | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
35 | + | ||
36 | + | ||
37 | + | func getKeyItemPrice (item) = (item + "_price") | |
38 | + | ||
39 | + | ||
40 | + | func getKeyItemData (item) = (item + "_data") | |
4 | 41 | ||
5 | 42 | ||
6 | 43 | @Callable(i) | |
7 | - | func basico (idade) = ScriptResult(WriteSet([DataEntry("idade", idade)]), TransferSet([ScriptTransfer(i.caller, idade, unit)])) | |
44 | + | func addItem (title,price,data) = { | |
45 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
46 | + | let item = getKeyItem(supplierAddress, title) | |
47 | + | if ((0 >= price)) | |
48 | + | then throw("Valor de compra não pode ser inferior a 0") | |
49 | + | else if ((getValueItemSupplier(item) != NONE)) | |
50 | + | then throw("O item já existe") | |
51 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
52 | + | } | |
8 | 53 | ||
9 | 54 |
github/deemru/w8io/169f3d6 43.07 ms ◑