tx · F8Lio1yyHw4A3rG6VgyLrYQ2tVhShxivJkx1fTjY9FCw

3N97fNcSZDMJQSbHFJVMvyN5NdJFnDHNYwf:  -0.01000000 Waves

2019.08.13 14:22 [629242] smart account 3N97fNcSZDMJQSbHFJVMvyN5NdJFnDHNYwf > SELF 0.00000000 Waves

{ "type": 13, "id": "F8Lio1yyHw4A3rG6VgyLrYQ2tVhShxivJkx1fTjY9FCw", "fee": 1000000, "feeAssetId": null, "timestamp": 1565695342019, "version": 1, "sender": "3N97fNcSZDMJQSbHFJVMvyN5NdJFnDHNYwf", "senderPublicKey": "GbFQqysRz2kuAvcS6LFvbvjtuuQ4e1dtiTeqcQgdue9m", "proofs": [ "2t7aUVDV3j6TZA3196DyMqxgihrEUmQyHReMJw6rGHF5ew3h5vN7PhMU1c51SmjdKRGaT8k9UJ9Xb8uqGERtG6cX" ], "script": "base64:AAIDAAAAAAAAAAAAAAABAAAAAAx3YXZlc0Fzc2V0SWQBAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAFpAQAAAARzZWxsAAAAAgAAAAVwcmljZQAAAApwcmljZUFzc2V0BAAAAAFwCQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQAAAAAAAAIIBQAAAAFwAAAAB2Fzc2V0SWQFAAAABHVuaXQJAAACAAAAAQIAAAAVWW91IGNhbid0IHNlbGwgV2F2ZXMuAwkAAGcAAAACAAAAAAAAAAAACAUAAAABcAAAAAZhbW91bnQJAAACAAAAAQIAAAASWW91IGNhbid0IG5vdGhpbmcuCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQACWAAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAZoAAAABBQAAAAVwcmljZQkAAZoAAAABCAUAAAABcAAAAAZhbW91bnQFAAAACnByaWNl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AAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAthbW91bnRUb0J1eQUAAAALYW1vdW50QXNzZXQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQUAAAAGc2VsbGVyBQAAAAVwcmljZQUAAAAKcHJpY2VBc3NldAUAAAADbmlsAAAAAB4//9c=", "chainId": 84, "height": 629242, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let wavesAssetId = base58'11111111111111111111111111111111'
5+
6+@Callable(i)
7+func sell (price,priceAsset) = {
8+ let p = extract(i.payment)
9+ if ((p.assetId == unit))
10+ then throw("You can't sell Waves.")
11+ else if ((0 >= p.amount))
12+ then throw("You can't nothing.")
13+ else WriteSet([DataEntry(toBase58String(i.transactionId), ((((toBytes(price) + toBytes(p.amount)) + priceAsset) + extract(extract(i.payment).assetId)) + i.callerPublicKey))])
14+ }
15+
16+
17+
18+@Callable(i)
19+func cancel (id) = {
20+ let data = extract(getBinary(this, id))
21+ let price = toInt(take(data, 8))
22+ let amount = toInt(take(drop(data, 0), 8))
23+ let priceAsset = take(drop(data, (8 + 8)), 32)
24+ let amountAsset = take(drop(data, ((8 + 8) + 32)), 32)
25+ let seller = drop(data, (((8 + 8) + 32) + 32))
26+ if ((seller != i.callerPublicKey))
27+ then throw("Invalid user.")
28+ else ScriptResult(WriteSet([DataEntry(id, ((((toBytes(price) + toBytes(0)) + priceAsset) + amountAsset) + seller))]), TransferSet([ScriptTransfer(addressFromPublicKey(seller), amount, amountAsset)]))
29+ }
30+
31+
32+
33+@Callable(i)
34+func buy (id) = {
35+ let data = extract(getBinary(this, id))
36+ let price = toInt(take(data, 8))
37+ let amount = toInt(take(drop(data, 0), 8))
38+ let pr = take(drop(data, (8 + 8)), 32)
39+ let priceAsset = if ((pr == wavesAssetId))
40+ then unit
41+ else pr
42+ let amountAsset = take(drop(data, ((8 + 8) + 32)), 32)
43+ let seller = drop(data, (((8 + 8) + 32) + 32))
44+ let p = extract(i.payment)
45+ let amountToBuy = (p.amount / price)
46+ if ((p.assetId == wavesAssetId))
47+ then throw("Invalid payment asset.")
48+ else if ((0 >= amountToBuy))
49+ then throw("Invalid payment amount.")
50+ else if (((amountToBuy * price) != p.amount))
51+ then throw("Invalid payment amount.")
52+ else if ((size(data) != ((((8 + 8) + 32) + 32) + 32)))
53+ then throw("Already sold or cancelled.")
54+ else if ((amountToBuy > amount))
55+ then throw("Not enough items in stock.")
56+ else if (if ((priceAsset != p.assetId))
57+ then true
58+ else !(if ((priceAsset == wavesAssetId))
59+ then (p.assetId == unit)
60+ else false))
61+ then throw("Invalid payment asset.")
62+ else ScriptResult(WriteSet([DataEntry(id, ((((toBytes(price) + toBytes((amount - amountToBuy))) + (if ((priceAsset == unit))
63+ then wavesAssetId
64+ else pr)) + amountAsset) + seller))]), TransferSet([ScriptTransfer(i.caller, amountToBuy, amountAsset), ScriptTransfer(addressFromPublicKey(seller), price, priceAsset)]))
65+ }
66+
67+

github/deemru/w8io/026f985 
20.11 ms