tx · Ehsc7HL5umkMKkM4FH3DM1VW1BYwDgCjXbndH7UMMMtY 3N8Cko4wa6ewdnPRXybzTMDpnhuYREfkps7: -0.00200000 Waves 2023.08.06 20:22 [2699023] smart account 3N8Cko4wa6ewdnPRXybzTMDpnhuYREfkps7 > SELF 0.00000000 Waves
{ "type": 13, "id": "Ehsc7HL5umkMKkM4FH3DM1VW1BYwDgCjXbndH7UMMMtY", "fee": 200000, "feeAssetId": null, "timestamp": 1691342704161, "version": 2, "chainId": 84, "sender": "3N8Cko4wa6ewdnPRXybzTMDpnhuYREfkps7", "senderPublicKey": "4oVxBvsmoAhMaT1WhgSLcKFKX1NzwYxDaR89cAdGRGky", "proofs": [ "kyZJwvpsg7NNqWq323D3Vdo3BGbifBei5ZWsVUdrDtNxjTTNXa3YqHvvZoPATd5cxynNzJGNFhFhSuTewaWCFsT" ], "script": "base64:BgIOCAISABIECgIIARIAEgAFAAVjaGFpbgkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQALdXNkdEFzc2V0SWQEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDABIITaerIIAz9O0bvKju6Lk7zJgt0LXfoHlqjUI/moD/+5AwkAAAIBAVQFByRtYXRjaDABIFWx2J9yh4Lv5eNbjawFq2XemkOhLxa7BfMat4el8cUYCQACAQINVW5rbm93biBjaGFpbgAPemJpbGxBc3NldElkS2V5Ag16YmlsbF9hc3NldElkAAx6YmlsbEFzc2V0SWQJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnAgCBQR0aGlzBQ96YmlsbEFzc2V0SWRLZXkCE05vdCBpbml0aWFsaXplZCB5ZXQAFHpiaWxsSXNzdWVkQW1vdW50S2V5AhJ6YmlsbF9pc3N1ZWRBbW91bnQEAWkBDWNvbnN0cnVjdG9yVjEAAwkBAiE9AggFAWkGY2FsbGVyBQR0aGlzCQACAQIRUGVybWlzc2lvbiBkZW5pZWQDCQEJaXNEZWZpbmVkAQkAoQgBBQ96Ymls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3BtdAdhc3NldElkAhNVU0RUIHBheW1lbnRzIG9ubHkhAwkBAiE9AgUKcG10QXNzZXRJZAULdXNkdEFzc2V0SWQJAAIBAhNVU0RUIHBheW1lbnRzIG9ubHkhBAxpc3N1ZWRBbW91bnQJARFAZXh0ck5hdGl2ZSgxMDU1KQEFFHpiaWxsSXNzdWVkQW1vdW50S2V5CQDMCAIJAQRCdXJuAgUMemJpbGxBc3NldElkBQNhbXQJAMwIAgkBDEludGVnZXJFbnRyeQIFFHpiaWxsSXNzdWVkQW1vdW50S2V5CQBlAgUMaXNzdWVkQW1vdW50BQNhbXQFA25pbAFpARBnZXRGdW5kc1JFQURPTkxZAAMJAQIhPQIJAJADAQgFAWkIcGF5bWVudHMAAAkAAgECE05vIHBheW1lbnRzIGFsbG93ZWQEB2Z1bmRTdW0JAGQCCQDwBwIFBHRoaXMFC3VzZHRBc3NldElkCQDwBwIFBHRoaXMFDHpiaWxsQXNzZXRJZAkAlAoCBQNuaWwFB2Z1bmRTdW0AulHkZA==", "height": 2699023, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EkdCbxSxbjkGJ7kWWU4fq5vGQj1iaXHUZpAgQKtNG2wZ Next: 3z1v5LtRkNZpftPpgWANmAEStmqdNx3YZ1AjTUCtgWfX Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let chain = take(drop(this.bytes, 1), 1) | |
5 | 5 | ||
6 | 6 | let usdtAssetId = match chain { | |
7 | 7 | case _ => | |
8 | 8 | if ((base58'2W' == $match0)) | |
9 | 9 | then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi' | |
10 | 10 | else if ((base58'2T' == $match0)) | |
11 | 11 | then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63' | |
12 | 12 | else throw("Unknown chain") | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | let zbillAssetIdKey = "zbill_assetId" | |
16 | 16 | ||
17 | 17 | let zbillAssetId = valueOrErrorMessage(getBinary(this, zbillAssetIdKey), "Not initialized yet") | |
18 | 18 | ||
19 | 19 | let zbillIssuedAmountKey = "zbill_issuedAmount" | |
20 | 20 | ||
21 | 21 | @Callable(i) | |
22 | 22 | func constructorV1 () = if ((i.caller != this)) | |
23 | 23 | then throw("Permission denied") | |
24 | 24 | else if (isDefined(getBinary(zbillAssetIdKey))) | |
25 | 25 | then throw("Already initialized") | |
26 | 26 | else { | |
27 | 27 | let issuedAmount = 0 | |
28 | 28 | let issue = Issue("ZBILL", "USDT Bill of Exchange token", issuedAmount, 6, true, unit, 0) | |
29 | 29 | let assetId = calculateAssetId(issue) | |
30 | 30 | [issue, IntegerEntry(zbillIssuedAmountKey, issuedAmount), BinaryEntry(zbillAssetIdKey, assetId)] | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | ||
35 | 35 | @Callable(i) | |
36 | 36 | func takeUsdt (destAddr,amount) = if ((i.caller != this)) | |
37 | 37 | then throw("permission denied") | |
38 | 38 | else if ((size(i.payments) != 0)) | |
39 | 39 | then throw("No payments allowed") | |
40 | 40 | else { | |
41 | 41 | let issuedAmount = getIntegerValue(zbillIssuedAmountKey) | |
42 | 42 | [Reissue(zbillAssetId, amount, true), IntegerEntry(zbillIssuedAmountKey, (issuedAmount + amount)), ScriptTransfer(addressFromStringValue(destAddr), amount, usdtAssetId)] | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | 47 | @Callable(i) | |
48 | 48 | func returnUsdt () = if ((size(i.payments) != 1)) | |
49 | 49 | then throw("exactly 1 payment must be attached") | |
50 | 50 | else { | |
51 | 51 | let pmt = i.payments[0] | |
52 | 52 | let amt = pmt.amount | |
53 | 53 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "USDT payments only!") | |
54 | 54 | if ((pmtAssetId != usdtAssetId)) | |
55 | 55 | then throw("USDT payments only!") | |
56 | 56 | else { | |
57 | 57 | let issuedAmount = getIntegerValue(zbillIssuedAmountKey) | |
58 | 58 | [Burn(zbillAssetId, amt), IntegerEntry(zbillIssuedAmountKey, (issuedAmount - amt))] | |
59 | 59 | } | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(i) | |
65 | 65 | func getFundsREADONLY () = if ((size(i.payments) != 0)) | |
66 | 66 | then throw("No payments allowed") | |
67 | 67 | else { | |
68 | 68 | let fundSum = (assetBalance(this, usdtAssetId) + assetBalance(this, zbillAssetId)) | |
69 | 69 | $Tuple2(nil, fundSum) | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 |
github/deemru/w8io/169f3d6 30.28 ms ◑