tx · 3z1v5LtRkNZpftPpgWANmAEStmqdNx3YZ1AjTUCtgWfX
3N8Cko4wa6ewdnPRXybzTMDpnhuYREfkps7: -0.00200000 Waves
2023.08.19 19:28 [2717725] smart account 3N8Cko4wa6ewdnPRXybzTMDpnhuYREfkps7 > SELF 0.00000000 Waves
{
"type": 13,
"id": "3z1v5LtRkNZpftPpgWANmAEStmqdNx3YZ1AjTUCtgWfX",
"fee": 200000,
"feeAssetId": null,
"timestamp": 1692462594617,
"version": 2,
"chainId": 84,
"sender": "3N8Cko4wa6ewdnPRXybzTMDpnhuYREfkps7",
"senderPublicKey": "4oVxBvsmoAhMaT1WhgSLcKFKX1NzwYxDaR89cAdGRGky",
"proofs": [
"3MPL4p6bwUxSZ4zQzH5SYRkBkcDABJ5SBUHkKrvDTjEvsS2QJK5EYxorUjjwPEqYprj5ZgX3EwH9ZSBUufMFe9Wr"
],
"script": "base64:BgIOCAISABIECgIIARIAEgAGAAVjaGFpbgkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQALdXNkdEFzc2V0SWQEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDABIITaerIIAz9O0bvKju6Lk7zJgt0LXfoHlqjUI/moD/+5AwkAAAIBAVQFByRtYXRjaDABIFWx2J9yh4Lv5eNbjawFq2XemkOhLxa7BfMat4el8cUYCQACAQINVW5rbm93biBjaGFpbgEKZml4ZWRQb2ludAIDdmFsCGRlY2ltYWxzBAZ0ZW5Qb3cJAGwGAAoAAAUIZGVjaW1hbHMAAAAABQRET1dOBAdsb3dQYXJ0CQCkAwEJAGoCBQN2YWwFBnRlblBvdwQGemVyb2VzCQCwAgIJAKQDAQUGdGVuUG93CQBkAgABCQCxAgEFB2xvd1BhcnQJAKwCAgkArAICCQCsAgIJAKQDAQkAaQIFA3ZhbAUGdGVuUG93AgEuBQZ6ZXJvZXMFB2xvd1BhcnQAD3piaWxsQXNzZXRJZEtleQINemJpbGxfYXNzZXRJZAAMemJpbGxBc3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DEwNjIpAQUIZGVzdEFkZHIFBmFtb3VudAULdXNkdEFzc2V0SWQFA25pbAFpAQpyZXR1cm5Vc2R0AAMJAQIhPQIJAJADAQgFAWkIcGF5bWVudHMAAQkAAgECImV4YWN0bHkgMSBwYXltZW50IG11c3QgYmUgYXR0YWNoZWQEA3BtdAkAkQMCCAUBaQhwYXltZW50cwAABANhbXQIBQNwbXQGYW1vdW50BApwbXRBc3NldElkCQETdmFsdWVPckVycm9yTWVzc2FnZQIIBQNwbXQHYXNzZXRJZAITVVNEVCBwYXltZW50cyBvbmx5IQMJAQIhPQIFCnBtdEFzc2V0SWQFC3VzZHRBc3NldElkCQACAQITVVNEVCBwYXltZW50cyBvbmx5IQQMaXNzdWVkQW1vdW50CQERQGV4dHJOYXRpdmUoMTA1NSkBBRR6YmlsbElzc3VlZEFtb3VudEtleQMJAGYCBQNhbXQFDGlzc3VlZEFtb3VudAkAAgEJAKwCAgkArAICCQCsAgIJAKwCAgIYQ2FuJ3QgcmV0dXJuIG1vcmUgVVNEVCAoCQEKZml4ZWRQb2ludAIFA2FtdAAGAhYpLCB0aGFuIGlzc3VlZCBaQklMTCAoCQEKZml4ZWRQb2ludAIFDGlzc3VlZEFtb3VudAAGAgEpCQDMCAIJAQRCdXJuAgUMemJpbGxBc3NldElkBQNhbXQJAMwIAgkBDEludGVnZXJFbnRyeQIFFHpiaWxsSXNzdWVkQW1vdW50S2V5CQBlAgUMaXNzdWVkQW1vdW50BQNhbXQFA25pbAFpARBnZXRGdW5kc1JFQURPTkxZAAMJAQIhPQIJAJADAQgFAWkIcGF5bWVudHMAAAkAAgECE05vIHBheW1lbnRzIGFsbG93ZWQEB2Z1bmRTdW0JAGQCCQDwBwIFBHRoaXMFC3VzZHRBc3NldElkCQDwBwIFBHRoaXMFDHpiaWxsQXNzZXRJZAkAlAoCBQNuaWwFB2Z1bmRTdW0AmTQtRQ==",
"height": 2717725,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: Ehsc7HL5umkMKkM4FH3DM1VW1BYwDgCjXbndH7UMMMtY
Next: GcvBRrUTjnLiYHkiPeMEyaCS57bPXLYYPa6bzfgW2Es4
Diff:
Old | New | | Differences |
---|
12 | 12 | | else throw("Unknown chain") |
---|
13 | 13 | | } |
---|
14 | 14 | | |
---|
15 | | - | let d = "zbill_assetId" |
---|
| 15 | + | func d (e,f) = { |
---|
| 16 | + | let g = pow(10, 0, f, 0, 0, DOWN) |
---|
| 17 | + | let h = toString((e % g)) |
---|
| 18 | + | let i = drop(toString(g), (1 + size(h))) |
---|
| 19 | + | (((toString((e / g)) + ".") + i) + h) |
---|
| 20 | + | } |
---|
16 | 21 | | |
---|
17 | | - | let e = valueOrErrorMessage(getBinary(this, d), "Not initialized yet") |
---|
18 | 22 | | |
---|
19 | | - | let f = "zbill_issuedAmount" |
---|
| 23 | + | let j = "zbill_assetId" |
---|
20 | 24 | | |
---|
21 | | - | @Callable(g) |
---|
22 | | - | func constructorV1 () = if ((g.caller != this)) |
---|
| 25 | + | let k = valueOrErrorMessage(getBinary(this, j), "Not initialized yet") |
---|
| 26 | + | |
---|
| 27 | + | let l = "zbill_issuedAmount" |
---|
| 28 | + | |
---|
| 29 | + | @Callable(m) |
---|
| 30 | + | func constructorV1 () = if ((m.caller != this)) |
---|
23 | 31 | | then throw("Permission denied") |
---|
24 | | - | else if (isDefined(getBinary(d))) |
---|
| 32 | + | else if (isDefined(getBinary(j))) |
---|
25 | 33 | | then throw("Already initialized") |
---|
26 | 34 | | else { |
---|
27 | | - | let h = 0 |
---|
28 | | - | let i = Issue("ZBILL", "USDT Bill of Exchange token", h, 6, true, unit, 0) |
---|
29 | | - | let j = calculateAssetId(i) |
---|
30 | | - | [i, IntegerEntry(f, h), BinaryEntry(d, j)] |
---|
| 35 | + | let n = 0 |
---|
| 36 | + | let o = Issue("ZBILL", "USDT Bill of Exchange token", n, 6, true, unit, 0) |
---|
| 37 | + | let p = calculateAssetId(o) |
---|
| 38 | + | [o, IntegerEntry(l, n), BinaryEntry(j, p)] |
---|
31 | 39 | | } |
---|
32 | 40 | | |
---|
33 | 41 | | |
---|
34 | 42 | | |
---|
35 | | - | @Callable(g) |
---|
36 | | - | func takeUsdt (k,l) = if ((g.caller != this)) |
---|
| 43 | + | @Callable(m) |
---|
| 44 | + | func takeUsdt (q,r) = if ((m.caller != this)) |
---|
37 | 45 | | then throw("permission denied") |
---|
38 | | - | else if ((size(g.payments) != 0)) |
---|
| 46 | + | else if ((size(m.payments) != 0)) |
---|
39 | 47 | | then throw("No payments allowed") |
---|
40 | 48 | | else { |
---|
41 | | - | let h = getIntegerValue(f) |
---|
42 | | - | [Reissue(e, l, true), IntegerEntry(f, (h + l)), ScriptTransfer(addressFromStringValue(k), l, b)] |
---|
| 49 | + | let n = getIntegerValue(l) |
---|
| 50 | + | [Reissue(k, r, true), IntegerEntry(l, (n + r)), ScriptTransfer(addressFromStringValue(q), r, b)] |
---|
43 | 51 | | } |
---|
44 | 52 | | |
---|
45 | 53 | | |
---|
46 | 54 | | |
---|
47 | | - | @Callable(g) |
---|
48 | | - | func returnUsdt () = if ((size(g.payments) != 1)) |
---|
| 55 | + | @Callable(m) |
---|
| 56 | + | func returnUsdt () = if ((size(m.payments) != 1)) |
---|
49 | 57 | | then throw("exactly 1 payment must be attached") |
---|
50 | 58 | | else { |
---|
51 | | - | let m = g.payments[0] |
---|
52 | | - | let n = m.amount |
---|
53 | | - | let o = valueOrErrorMessage(m.assetId, "USDT payments only!") |
---|
54 | | - | if ((o != b)) |
---|
| 59 | + | let s = m.payments[0] |
---|
| 60 | + | let t = s.amount |
---|
| 61 | + | let u = valueOrErrorMessage(s.assetId, "USDT payments only!") |
---|
| 62 | + | if ((u != b)) |
---|
55 | 63 | | then throw("USDT payments only!") |
---|
56 | 64 | | else { |
---|
57 | | - | let h = getIntegerValue(f) |
---|
58 | | - | [Burn(e, n), IntegerEntry(f, (h - n))] |
---|
| 65 | + | let n = getIntegerValue(l) |
---|
| 66 | + | if ((t > n)) |
---|
| 67 | + | then throw((((("Can't return more USDT (" + d(t, 6)) + "), than issued ZBILL (") + d(n, 6)) + ")")) |
---|
| 68 | + | else [Burn(k, t), IntegerEntry(l, (n - t))] |
---|
59 | 69 | | } |
---|
60 | 70 | | } |
---|
61 | 71 | | |
---|
62 | 72 | | |
---|
63 | 73 | | |
---|
64 | | - | @Callable(g) |
---|
65 | | - | func getFundsREADONLY () = if ((size(g.payments) != 0)) |
---|
| 74 | + | @Callable(m) |
---|
| 75 | + | func getFundsREADONLY () = if ((size(m.payments) != 0)) |
---|
66 | 76 | | then throw("No payments allowed") |
---|
67 | 77 | | else { |
---|
68 | | - | let p = (assetBalance(this, b) + assetBalance(this, e)) |
---|
69 | | - | $Tuple2(nil, p) |
---|
| 78 | + | let v = (assetBalance(this, b) + assetBalance(this, k)) |
---|
| 79 | + | $Tuple2(nil, v) |
---|
70 | 80 | | } |
---|
71 | 81 | | |
---|
72 | 82 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 6 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let a = take(drop(this.bytes, 1), 1) |
---|
5 | 5 | | |
---|
6 | 6 | | let b = { |
---|
7 | 7 | | let c = a |
---|
8 | 8 | | if ((base58'2W' == c)) |
---|
9 | 9 | | then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi' |
---|
10 | 10 | | else if ((base58'2T' == c)) |
---|
11 | 11 | | then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63' |
---|
12 | 12 | | else throw("Unknown chain") |
---|
13 | 13 | | } |
---|
14 | 14 | | |
---|
15 | | - | let d = "zbill_assetId" |
---|
| 15 | + | func d (e,f) = { |
---|
| 16 | + | let g = pow(10, 0, f, 0, 0, DOWN) |
---|
| 17 | + | let h = toString((e % g)) |
---|
| 18 | + | let i = drop(toString(g), (1 + size(h))) |
---|
| 19 | + | (((toString((e / g)) + ".") + i) + h) |
---|
| 20 | + | } |
---|
16 | 21 | | |
---|
17 | | - | let e = valueOrErrorMessage(getBinary(this, d), "Not initialized yet") |
---|
18 | 22 | | |
---|
19 | | - | let f = "zbill_issuedAmount" |
---|
| 23 | + | let j = "zbill_assetId" |
---|
20 | 24 | | |
---|
21 | | - | @Callable(g) |
---|
22 | | - | func constructorV1 () = if ((g.caller != this)) |
---|
| 25 | + | let k = valueOrErrorMessage(getBinary(this, j), "Not initialized yet") |
---|
| 26 | + | |
---|
| 27 | + | let l = "zbill_issuedAmount" |
---|
| 28 | + | |
---|
| 29 | + | @Callable(m) |
---|
| 30 | + | func constructorV1 () = if ((m.caller != this)) |
---|
23 | 31 | | then throw("Permission denied") |
---|
24 | | - | else if (isDefined(getBinary(d))) |
---|
| 32 | + | else if (isDefined(getBinary(j))) |
---|
25 | 33 | | then throw("Already initialized") |
---|
26 | 34 | | else { |
---|
27 | | - | let h = 0 |
---|
28 | | - | let i = Issue("ZBILL", "USDT Bill of Exchange token", h, 6, true, unit, 0) |
---|
29 | | - | let j = calculateAssetId(i) |
---|
30 | | - | [i, IntegerEntry(f, h), BinaryEntry(d, j)] |
---|
| 35 | + | let n = 0 |
---|
| 36 | + | let o = Issue("ZBILL", "USDT Bill of Exchange token", n, 6, true, unit, 0) |
---|
| 37 | + | let p = calculateAssetId(o) |
---|
| 38 | + | [o, IntegerEntry(l, n), BinaryEntry(j, p)] |
---|
31 | 39 | | } |
---|
32 | 40 | | |
---|
33 | 41 | | |
---|
34 | 42 | | |
---|
35 | | - | @Callable(g) |
---|
36 | | - | func takeUsdt (k,l) = if ((g.caller != this)) |
---|
| 43 | + | @Callable(m) |
---|
| 44 | + | func takeUsdt (q,r) = if ((m.caller != this)) |
---|
37 | 45 | | then throw("permission denied") |
---|
38 | | - | else if ((size(g.payments) != 0)) |
---|
| 46 | + | else if ((size(m.payments) != 0)) |
---|
39 | 47 | | then throw("No payments allowed") |
---|
40 | 48 | | else { |
---|
41 | | - | let h = getIntegerValue(f) |
---|
42 | | - | [Reissue(e, l, true), IntegerEntry(f, (h + l)), ScriptTransfer(addressFromStringValue(k), l, b)] |
---|
| 49 | + | let n = getIntegerValue(l) |
---|
| 50 | + | [Reissue(k, r, true), IntegerEntry(l, (n + r)), ScriptTransfer(addressFromStringValue(q), r, b)] |
---|
43 | 51 | | } |
---|
44 | 52 | | |
---|
45 | 53 | | |
---|
46 | 54 | | |
---|
47 | | - | @Callable(g) |
---|
48 | | - | func returnUsdt () = if ((size(g.payments) != 1)) |
---|
| 55 | + | @Callable(m) |
---|
| 56 | + | func returnUsdt () = if ((size(m.payments) != 1)) |
---|
49 | 57 | | then throw("exactly 1 payment must be attached") |
---|
50 | 58 | | else { |
---|
51 | | - | let m = g.payments[0] |
---|
52 | | - | let n = m.amount |
---|
53 | | - | let o = valueOrErrorMessage(m.assetId, "USDT payments only!") |
---|
54 | | - | if ((o != b)) |
---|
| 59 | + | let s = m.payments[0] |
---|
| 60 | + | let t = s.amount |
---|
| 61 | + | let u = valueOrErrorMessage(s.assetId, "USDT payments only!") |
---|
| 62 | + | if ((u != b)) |
---|
55 | 63 | | then throw("USDT payments only!") |
---|
56 | 64 | | else { |
---|
57 | | - | let h = getIntegerValue(f) |
---|
58 | | - | [Burn(e, n), IntegerEntry(f, (h - n))] |
---|
| 65 | + | let n = getIntegerValue(l) |
---|
| 66 | + | if ((t > n)) |
---|
| 67 | + | then throw((((("Can't return more USDT (" + d(t, 6)) + "), than issued ZBILL (") + d(n, 6)) + ")")) |
---|
| 68 | + | else [Burn(k, t), IntegerEntry(l, (n - t))] |
---|
59 | 69 | | } |
---|
60 | 70 | | } |
---|
61 | 71 | | |
---|
62 | 72 | | |
---|
63 | 73 | | |
---|
64 | | - | @Callable(g) |
---|
65 | | - | func getFundsREADONLY () = if ((size(g.payments) != 0)) |
---|
| 74 | + | @Callable(m) |
---|
| 75 | + | func getFundsREADONLY () = if ((size(m.payments) != 0)) |
---|
66 | 76 | | then throw("No payments allowed") |
---|
67 | 77 | | else { |
---|
68 | | - | let p = (assetBalance(this, b) + assetBalance(this, e)) |
---|
69 | | - | $Tuple2(nil, p) |
---|
| 78 | + | let v = (assetBalance(this, b) + assetBalance(this, k)) |
---|
| 79 | + | $Tuple2(nil, v) |
---|
70 | 80 | | } |
---|
71 | 81 | | |
---|
72 | 82 | | |
---|