tx · GwgbSWqtibdHZnHL7UujJPBY1hjEi4v7QAoBpDVgHUb9
3MpKvUfNxrgF7QotPjFwi8thMagSveNScKe: -0.01400000 Waves
2020.11.03 01:58 [1248311] smart account 3MpKvUfNxrgF7QotPjFwi8thMagSveNScKe > SELF 0.00000000 Waves
{
"type": 13,
"id": "GwgbSWqtibdHZnHL7UujJPBY1hjEi4v7QAoBpDVgHUb9",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1604357706846,
"version": 2,
"chainId": 84,
"sender": "3MpKvUfNxrgF7QotPjFwi8thMagSveNScKe",
"senderPublicKey": "9GE2xN4fms9YNDxR1hGg52RynqDd8125TA42g4X29ZV7",
"proofs": [
"3DAELeANBDJF31dwRx6HZAd2RbzkomDsquKtxTSJGwRG4YNZNSMjFyaE6MYM9Txe8VDr1bGsMSoQvui8XrVnZE8D"
],
"script": "base64:AAIEAAAAAAAAABUIAhIGCgQIAQEIEgQKAggIEgMKAQgAAAAEAAAAAAJjZgkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQkAAlkAAAABAgAAACxKN3Z5b1VBOEdkNVFNcTRZVnRlZHB2MTlkd0NZcm9aRVlyTjhiS2dMenFWOAAAAAAEb3BicgEAAAAg8w+nJ903R+IZ8oK5CbdbBTqw7e4xxmj9cHNLUMCmE7gBAAAAEGdldEFsbG93ZWRUb2tlbnMAAAABAAAAB3Rva2VuSWQEAAAABWFsbG93BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAB3Rva2VuSWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQcFAAAABWFsbG93AQAAAAtjb21wYXJlSGFzaAAAAAIAAAABYwAAAAFoCQAAAAAAAAIJAAH1AAAAAQkAAfYAAAABCQABmwAAAAEFAAAAAWMJAAJZAAAAAQUAAAABaAAAAAMAAAABaQEAAAAHb3BickJ1eQAAAAQAAAAHdG9rZW5JZAAAAAN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AAAC0RlbGV0ZUVudHJ5AAAAAQUAAAAHdG9rZW5JZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAJjZgAAAAAAAJiWgAUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXmJJERe",
"height": 1248311,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 7wHkTWcGU57iWPGimJtTKvZFy1qokkMd1r2Dcfg596BG
Next: CXrwsBCHoc9zzcCq2u8bxuduwUtTFRvdQDUJJBtyKR39
Diff:
Old | New | | Differences |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let cf = addressFromPublicKey(fromBase58String("J7vyoUA8Gd5QMq4YVtedpv19dwCYroZEYrN8bKgLzqV8")) |
---|
5 | 5 | | |
---|
6 | | - | let opbr = base58'BN6ta4Sfmmh8tfmJE4pqJrSxLNJReAqnerPePYqkjcjG' |
---|
| 6 | + | let opbr = base58'HMov2457acf5MEJr85fvXYL3vrTEevFpsEQkHh1yfdUT' |
---|
7 | 7 | | |
---|
8 | 8 | | func getAllowedTokens (tokenId) = { |
---|
9 | 9 | | let allow = match getString(this, tokenId) { |
---|
|
26 | 26 | | let allowed = getAllowedTokens(tokenId) |
---|
27 | 27 | | if ((size(pmt) == 0)) |
---|
28 | 28 | | then throw("Payment for exchange is mandatory") |
---|
29 | | - | else if (!(compareHash((tokenId + toString(((qtd + price) + pmt[0].amount))), hash))) |
---|
30 | | - | then throw("Purchase information is incompatible") |
---|
31 | | - | else if (if (isDefined(pmt[0].assetId)) |
---|
32 | | - | then (allowed == false) |
---|
33 | | - | else false) |
---|
34 | | - | then throw("The used token is not accepted") |
---|
| 29 | + | else if ((size(pmt) == 2)) |
---|
| 30 | + | then throw("Only one payment per transaction is allowed") |
---|
| 31 | + | else if (!(compareHash((tokenId + toString(((qtd + price) + pmt[0].amount))), hash))) |
---|
| 32 | + | then throw("Purchase information is incompatible") |
---|
35 | 33 | | else if (if (isDefined(pmt[0].assetId)) |
---|
36 | | - | then (fromBase58String(tokenId) != pmt[0].assetId) |
---|
| 34 | + | then (allowed == false) |
---|
37 | 35 | | else false) |
---|
38 | | - | then throw("declared token is different from submitted token") |
---|
39 | | - | else { |
---|
40 | | - | let c = fraction(1, pmt[0].amount, 100) |
---|
| 36 | + | then throw("The used token is not accepted") |
---|
| 37 | + | else if (if (isDefined(pmt[0].assetId)) |
---|
| 38 | + | then (fromBase58String(tokenId) != pmt[0].assetId) |
---|
| 39 | + | else false) |
---|
| 40 | + | then throw("declared token is different from submitted token") |
---|
| 41 | + | else { |
---|
| 42 | + | let c = fraction(1, pmt[0].amount, 100) |
---|
41 | 43 | | [ScriptTransfer(i.caller, qtd, opbr), ScriptTransfer(cf, c, pmt[0].assetId)] |
---|
42 | | - | } |
---|
| 44 | + | } |
---|
43 | 45 | | } |
---|
44 | 46 | | |
---|
45 | 47 | | |
---|
|
47 | 49 | | @Callable(i) |
---|
48 | 50 | | func tokenList (tokenId,ticker) = { |
---|
49 | 51 | | let Addr = toBase58String(i.caller.bytes) |
---|
50 | | - | if ((Addr != toString(this))) |
---|
| 52 | + | if (if ((Addr != toString(this))) |
---|
| 53 | + | then true |
---|
| 54 | + | else (Addr != toString(cf))) |
---|
51 | 55 | | then throw("The address is not authorized to list tokens") |
---|
52 | 56 | | else [StringEntry(tokenId, ticker), ScriptTransfer(cf, 1000000, unit)] |
---|
53 | 57 | | } |
---|
|
57 | 61 | | @Callable(i) |
---|
58 | 62 | | func tokenDelist (tokenId) = { |
---|
59 | 63 | | let Addr = toBase58String(i.caller.bytes) |
---|
60 | | - | if ((Addr != toString(this))) |
---|
| 64 | + | if (if ((Addr != toString(this))) |
---|
| 65 | + | then true |
---|
| 66 | + | else (Addr != toString(cf))) |
---|
61 | 67 | | then throw("The address is not authorized to delist tokens") |
---|
62 | 68 | | else [DeleteEntry(tokenId), ScriptTransfer(cf, 10000000, unit)] |
---|
63 | 69 | | } |
---|
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 | | - | let opbr = base58'BN6ta4Sfmmh8tfmJE4pqJrSxLNJReAqnerPePYqkjcjG' |
---|
| 6 | + | let opbr = base58'HMov2457acf5MEJr85fvXYL3vrTEevFpsEQkHh1yfdUT' |
---|
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 | | - | else if (!(compareHash((tokenId + toString(((qtd + price) + pmt[0].amount))), hash))) |
---|
30 | | - | then throw("Purchase information is incompatible") |
---|
31 | | - | else if (if (isDefined(pmt[0].assetId)) |
---|
32 | | - | then (allowed == false) |
---|
33 | | - | else false) |
---|
34 | | - | then throw("The used token is not accepted") |
---|
| 29 | + | else if ((size(pmt) == 2)) |
---|
| 30 | + | then throw("Only one payment per transaction is allowed") |
---|
| 31 | + | else if (!(compareHash((tokenId + toString(((qtd + price) + pmt[0].amount))), hash))) |
---|
| 32 | + | then throw("Purchase information is incompatible") |
---|
35 | 33 | | else if (if (isDefined(pmt[0].assetId)) |
---|
36 | | - | then (fromBase58String(tokenId) != pmt[0].assetId) |
---|
| 34 | + | then (allowed == false) |
---|
37 | 35 | | else false) |
---|
38 | | - | then throw("declared token is different from submitted token") |
---|
39 | | - | else { |
---|
40 | | - | let c = fraction(1, pmt[0].amount, 100) |
---|
| 36 | + | then throw("The used token is not accepted") |
---|
| 37 | + | else if (if (isDefined(pmt[0].assetId)) |
---|
| 38 | + | then (fromBase58String(tokenId) != pmt[0].assetId) |
---|
| 39 | + | else false) |
---|
| 40 | + | then throw("declared token is different from submitted token") |
---|
| 41 | + | else { |
---|
| 42 | + | let c = fraction(1, pmt[0].amount, 100) |
---|
41 | 43 | | [ScriptTransfer(i.caller, qtd, opbr), ScriptTransfer(cf, c, pmt[0].assetId)] |
---|
42 | | - | } |
---|
| 44 | + | } |
---|
43 | 45 | | } |
---|
44 | 46 | | |
---|
45 | 47 | | |
---|
46 | 48 | | |
---|
47 | 49 | | @Callable(i) |
---|
48 | 50 | | func tokenList (tokenId,ticker) = { |
---|
49 | 51 | | let Addr = toBase58String(i.caller.bytes) |
---|
50 | | - | if ((Addr != toString(this))) |
---|
| 52 | + | if (if ((Addr != toString(this))) |
---|
| 53 | + | then true |
---|
| 54 | + | else (Addr != toString(cf))) |
---|
51 | 55 | | then throw("The address is not authorized to list tokens") |
---|
52 | 56 | | else [StringEntry(tokenId, ticker), ScriptTransfer(cf, 1000000, unit)] |
---|
53 | 57 | | } |
---|
54 | 58 | | |
---|
55 | 59 | | |
---|
56 | 60 | | |
---|
57 | 61 | | @Callable(i) |
---|
58 | 62 | | func tokenDelist (tokenId) = { |
---|
59 | 63 | | let Addr = toBase58String(i.caller.bytes) |
---|
60 | | - | if ((Addr != toString(this))) |
---|
| 64 | + | if (if ((Addr != toString(this))) |
---|
| 65 | + | then true |
---|
| 66 | + | else (Addr != toString(cf))) |
---|
61 | 67 | | then throw("The address is not authorized to delist tokens") |
---|
62 | 68 | | else [DeleteEntry(tokenId), ScriptTransfer(cf, 10000000, unit)] |
---|
63 | 69 | | } |
---|
64 | 70 | | |
---|
65 | 71 | | |
---|
66 | 72 | | @Verifier(tx) |
---|
67 | 73 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
68 | 74 | | |
---|