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