tx · 5R3UgoPr5yrLBYn9tkS1vbxHtVXno8g8tkVtKs8Y4mKB

3N9nVNxRXkYG1LxBamitnLpZzXcjGDZ2Q6z:  -0.01400000 Waves

2019.10.17 01:45 [723173] smart account 3N9nVNxRXkYG1LxBamitnLpZzXcjGDZ2Q6z > SELF 0.00000000 Waves

{ "type": 13, "id": "5R3UgoPr5yrLBYn9tkS1vbxHtVXno8g8tkVtKs8Y4mKB", "fee": 1400000, "feeAssetId": null, "timestamp": 1571265807393, "version": 1, "sender": "3N9nVNxRXkYG1LxBamitnLpZzXcjGDZ2Q6z", "senderPublicKey": "EEGsMXJbL3i6pER7gfBpcw87Km3h2gz6qiqhqPXbdob1", "proofs": [ "3vLW2ZuKjUnwBcXWdgoNsqhL9fCtZMfGARgMr4EHgemfT42aLVqxZzez855CZSxBSLqJu3K1vMChEkYr5eTNPdAu" ], "script": "base64:AAIDAAAAAAAAABIIARIAEgUKAwgBCBIAEgMKAQEAAAANAAAAAAVvd25lcgEAAAAgxI5sOc85F96AyMEOQS+ZrrcXbjWOtavgO5Vy9VGjFCwBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAABG5vbmUFAAAABnN0cmluZwEAAAAPZ2V0SXRlbUtleVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0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UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABHVuaXQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABYQUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAABW93bmVyAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWIFAAAAByRtYXRjaDAGB8xVdWQ=", "chainId": 84, "height": 723173, "spentComplexity": 0 } View: original | compacted Prev: 8NCvqyjmtQstQ75WrkrNXTxFduHQxDRAYpJfvVeotNXD Next: 52xKkKdaBEAYbHWbm2QPGu3Pm2SA95jyQ8wUdrigUJcB Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let owner = base58'EEGsMXJbL3i6pER7gfBpcw87Km3h2gz6qiqhqPXbdob1'
55
6-@Callable(i)
7-func purchare () = {
8- let pmt = extract(i.payment)
9- if (isDefined(pmt.assetId))
10- then throw("you can use WAVES only at the moment")
11- else {
12- let customerAddres = toBase58String(i.caller.bytes)
13- let price = match getInteger(this, "item_A_coupon_price") {
14- case a: Int =>
15- a
16- case _ =>
17- 0
18- }
19- if ((price > pmt.amount))
20- then throw("purchare amount cannot be less that item price")
21- else if ((pmt.amount > price))
22- then throw("purchare amount cannot be higher that item price")
23- else WriteSet([DataEntry(("status:purchare_item_A_customer_" + customerAddres), "confirmed"), DataEntry(("price:purchare_item_A_customer" + customerAddres), price)])
24- }
6+func getNumberByKey (key) = {
7+ let number = match getInteger(this, key) {
8+ case a: Int =>
9+ a
10+ case _ =>
11+ 0
12+ }
13+ number
2514 }
2615
16+
17+func getStringByKey (key) = {
18+ let string = match getString(this, key) {
19+ case a: String =>
20+ a
21+ case _ =>
22+ "none"
23+ }
24+ string
25+ }
26+
27+
28+func getItemKeyPrice (item) = (item + "_price")
29+
30+
31+func getValueItemPrice (item) = getNumberByKey(getItemKeyPrice(item))
32+
33+
34+func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "count")
35+
36+
37+func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
38+
39+
40+func getKeyItem (supplier,title) = ("item_" + toBase58String(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) = getStringByKey(getKeyItemSupplier(item))
50+
51+
52+func getKeyBalanceSupplier (account) = (account + "_balance")
53+
54+
55+func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
2756
2857
2958 @Callable(i)
4776 }
4877 let newAmount = (currentAmount + pmt.amount)
4978 WriteSet([DataEntry(currentKey, newAmount)])
79+ }
80+ }
81+
82+
83+
84+@Callable(i)
85+func addItem (title,price,data) = {
86+ let supplierAddres = toBase58String(i.caller.bytes)
87+ let item = getKeyItem(supplierAddres, title)
88+ if ((0 >= price))
89+ then throw("purchase amount cannot be less that item price")
90+ else if (("none" != getValueItemSupplier(item)))
91+ then throw("an item is alreadt exist")
92+ else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddres), DataEntry(getItemKeyPrice(item), price), DataEntry(getKeyItemData(item), data)])
93+ }
94+
95+
96+
97+@Callable(i)
98+func purchare () = {
99+ let pmt = extract(i.payment)
100+ if (isDefined(pmt.assetId))
101+ then throw("you can use WAVES only at the moment")
102+ else {
103+ let customerAddres = toBase58String(i.caller.bytes)
104+ let price = match getInteger(this, "item_A_coupon_price") {
105+ case a: Int =>
106+ a
107+ case _ =>
108+ 0
109+ }
110+ if ((price > pmt.amount))
111+ then throw("purchare amount cannot be less that item price")
112+ else if ((pmt.amount > price))
113+ then throw("purchare amount cannot be higher that item price")
114+ else WriteSet([DataEntry(("status:purchare_item_A_customer_" + customerAddres), "confirmed"), DataEntry(("price:purchare_item_A_customer" + customerAddres), price)])
50115 }
51116 }
52117
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let owner = base58'EEGsMXJbL3i6pER7gfBpcw87Km3h2gz6qiqhqPXbdob1'
55
6-@Callable(i)
7-func purchare () = {
8- let pmt = extract(i.payment)
9- if (isDefined(pmt.assetId))
10- then throw("you can use WAVES only at the moment")
11- else {
12- let customerAddres = toBase58String(i.caller.bytes)
13- let price = match getInteger(this, "item_A_coupon_price") {
14- case a: Int =>
15- a
16- case _ =>
17- 0
18- }
19- if ((price > pmt.amount))
20- then throw("purchare amount cannot be less that item price")
21- else if ((pmt.amount > price))
22- then throw("purchare amount cannot be higher that item price")
23- else WriteSet([DataEntry(("status:purchare_item_A_customer_" + customerAddres), "confirmed"), DataEntry(("price:purchare_item_A_customer" + customerAddres), price)])
24- }
6+func getNumberByKey (key) = {
7+ let number = match getInteger(this, key) {
8+ case a: Int =>
9+ a
10+ case _ =>
11+ 0
12+ }
13+ number
2514 }
2615
16+
17+func getStringByKey (key) = {
18+ let string = match getString(this, key) {
19+ case a: String =>
20+ a
21+ case _ =>
22+ "none"
23+ }
24+ string
25+ }
26+
27+
28+func getItemKeyPrice (item) = (item + "_price")
29+
30+
31+func getValueItemPrice (item) = getNumberByKey(getItemKeyPrice(item))
32+
33+
34+func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "count")
35+
36+
37+func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
38+
39+
40+func getKeyItem (supplier,title) = ("item_" + toBase58String(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) = getStringByKey(getKeyItemSupplier(item))
50+
51+
52+func getKeyBalanceSupplier (account) = (account + "_balance")
53+
54+
55+func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
2756
2857
2958 @Callable(i)
3059 func deposit () = {
3160 let pmt = extract(i.payment)
3261 if (isDefined(pmt.assetId))
3362 then throw("you can use WAVES only at the moment")
3463 else {
3564 let currentKey = toBase58String(i.caller.bytes)
3665 let currentAmount = match getInteger(this, ("wl_sts" + currentKey)) {
3766 case a: Int =>
3867 a
3968 case _ =>
4069 0
4170 }
4271 let wlStsCurr = match getString(this, ("wls_sts" + currentKey)) {
4372 case a: String =>
4473 a
4574 case _ =>
4675 throw("user has not waitlisted")
4776 }
4877 let newAmount = (currentAmount + pmt.amount)
4978 WriteSet([DataEntry(currentKey, newAmount)])
79+ }
80+ }
81+
82+
83+
84+@Callable(i)
85+func addItem (title,price,data) = {
86+ let supplierAddres = toBase58String(i.caller.bytes)
87+ let item = getKeyItem(supplierAddres, title)
88+ if ((0 >= price))
89+ then throw("purchase amount cannot be less that item price")
90+ else if (("none" != getValueItemSupplier(item)))
91+ then throw("an item is alreadt exist")
92+ else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddres), DataEntry(getItemKeyPrice(item), price), DataEntry(getKeyItemData(item), data)])
93+ }
94+
95+
96+
97+@Callable(i)
98+func purchare () = {
99+ let pmt = extract(i.payment)
100+ if (isDefined(pmt.assetId))
101+ then throw("you can use WAVES only at the moment")
102+ else {
103+ let customerAddres = toBase58String(i.caller.bytes)
104+ let price = match getInteger(this, "item_A_coupon_price") {
105+ case a: Int =>
106+ a
107+ case _ =>
108+ 0
109+ }
110+ if ((price > pmt.amount))
111+ then throw("purchare amount cannot be less that item price")
112+ else if ((pmt.amount > price))
113+ then throw("purchare amount cannot be higher that item price")
114+ else WriteSet([DataEntry(("status:purchare_item_A_customer_" + customerAddres), "confirmed"), DataEntry(("price:purchare_item_A_customer" + customerAddres), price)])
50115 }
51116 }
52117
53118
54119
55120 @Callable(i)
56121 func withdraw (amount) = {
57122 let currentKey = toBase58String(i.caller.bytes)
58123 let currentAmount = match getInteger(this, currentKey) {
59124 case a: Int =>
60125 a
61126 case _ =>
62127 0
63128 }
64129 let newAmount = (currentAmount - amount)
65130 if ((0 > amount))
66131 then throw("can't withdraw negative amount")
67132 else if ((0 > newAmount))
68133 then throw("not enough balance")
69134 else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
70135 }
71136
72137
73138 @Verifier(tx)
74139 func verify () = match tx {
75140 case a: SetScriptTransaction =>
76141 sigVerify(tx.bodyBytes, tx.proofs[0], owner)
77142 case b: DataTransaction =>
78143 true
79144 case _ =>
80145 false
81146 }
82147

github/deemru/w8io/169f3d6 
31.82 ms