tx · 37qPGv7987a7mXYAqAA78pbs4CGL1hDv2NpAZh75B1F7 3MpKvUfNxrgF7QotPjFwi8thMagSveNScKe: -0.01400000 Waves 2020.11.01 22:07 [1246643] smart account 3MpKvUfNxrgF7QotPjFwi8thMagSveNScKe > SELF 0.00000000 Waves
{ "type": 13, "id": "37qPGv7987a7mXYAqAA78pbs4CGL1hDv2NpAZh75B1F7", "fee": 1400000, "feeAssetId": null, "timestamp": 1604257694057, "version": 2, "chainId": 84, "sender": "3MpKvUfNxrgF7QotPjFwi8thMagSveNScKe", "senderPublicKey": "9GE2xN4fms9YNDxR1hGg52RynqDd8125TA42g4X29ZV7", "proofs": [ "39d4SBW28PrtGW9v1gF4oZNzyAwbyRvAmt4gDdnrboL2hajVyGGoasi7EPNvwgkyiWvx8QXNSVwi9BCc6m2hrfsD" ], "script": "base64:AAIEAAAAAAAAABUIAhIGCgQIAQEIEgQKAggIEgMKAQgAAAAEAAAAAAJjZgkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQkAAlkAAAABAgAAACxKN3Z5b1VBOEdkNVFNcTRZVnRlZHB2MTlkd0NZcm9aRVlyTjhiS2dMenFWOAAAAAAEb3BicgEAAAAgmfy5oa9oHbJYecHXssaagqIhQYzkPpfErZjoZUq4xX8BAAAAEGdldEFsbG93ZWRUb2tlbnMAAAABAAAAB3Rva2VuSWQEAAAABWFsbG93BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAB3Rva2VuSWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQcFAAAABWFsbG93AQAAAAtjb21wYXJlSGFzaAAAAAIAAAABYwAAAAFoCQAAAAAAAAIJAAH1AAAAAQkAAfYAAAABCQABmwAAAAEFAAAAAWMJAAJZAAAAAQUAAAABaAAAAAMAAAABaQEAAAAHb3BickJ1eQAAAAQAAAAHdG9rZW5JZAAAAANxdGQAAAAFcHJpY2UAA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NLZXl8gjNm", "height": 1246643, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CMPVXWkuLRGLDaV3Zo4i8NPS966xdeQtS5nygwQbDWpj Next: 7wHkTWcGU57iWPGimJtTKvZFy1qokkMd1r2Dcfg596BG Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let cf = addressFromPublicKey(fromBase58String("J7vyoUA8Gd5QMq4YVtedpv19dwCYroZEYrN8bKgLzqV8")) | |
5 | 5 | ||
6 | 6 | let opbr = base58'BN6ta4Sfmmh8tfmJE4pqJrSxLNJReAqnerPePYqkjcjG' | |
7 | 7 | ||
8 | 8 | func getAllowedTokens (tokenId) = { | |
9 | 9 | let allow = match getString(this, tokenId) { | |
10 | 10 | case a: String => | |
11 | 11 | a | |
12 | 12 | case _ => | |
13 | 13 | false | |
14 | 14 | } | |
15 | 15 | allow | |
16 | 16 | } | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func compareHash (c,h) = (keccak256(blake2b256(toBytes(c))) == fromBase58String(h)) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | @Callable(i) | |
23 | 23 | func opbrBuy (tokenId,qtd,price,hash) = { | |
24 | 24 | let buyerAddr = toBase58String(i.caller.bytes) | |
25 | 25 | let pmt = i.payments | |
26 | 26 | let allowed = getAllowedTokens(tokenId) | |
27 | 27 | if ((size(pmt) == 0)) | |
28 | 28 | then throw("Payment for exchange is mandatory") | |
29 | 29 | else if (!(compareHash((tokenId + toString((qtd * price))), hash))) | |
30 | 30 | then throw("Purchase information is incompatible") | |
31 | 31 | else if (if (isDefined(pmt[0].assetId)) | |
32 | 32 | then (allowed == false) | |
33 | 33 | else false) | |
34 | 34 | then throw("The used token is not accepted") | |
35 | 35 | else if (if (isDefined(pmt[0].assetId)) | |
36 | 36 | then (fromBase58String(tokenId) != pmt[0].assetId) | |
37 | 37 | else false) | |
38 | 38 | then throw("declared token is different from submitted token") | |
39 | 39 | else { | |
40 | 40 | let c = fraction(1, pmt[0].amount, 100) | |
41 | 41 | [ScriptTransfer(i.caller, qtd, opbr), ScriptTransfer(cf, c, pmt[0].assetId)] | |
42 | 42 | } | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | 47 | @Callable(i) | |
48 | 48 | func tokenList (tokenId,ticker) = { | |
49 | 49 | let Addr = toBase58String(i.caller.bytes) | |
50 | 50 | if ((Addr != toString(this))) | |
51 | 51 | then throw("The address is not authorized to list tokens") | |
52 | 52 | else [StringEntry(tokenId, ticker), ScriptTransfer(cf, 1000000, unit)] | |
53 | 53 | } | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Callable(i) | |
58 | 58 | func tokenDelist (tokenId) = { | |
59 | 59 | let Addr = toBase58String(i.caller.bytes) | |
60 | 60 | if ((Addr != toString(this))) | |
61 | 61 | then throw("The address is not authorized to delist tokens") | |
62 | 62 | else [DeleteEntry(tokenId), ScriptTransfer(cf, 10000000, unit)] | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | @Verifier(tx) | |
67 | 67 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
68 | 68 |
github/deemru/w8io/169f3d6 25.38 ms ◑