tx · 58JxT4m7pynn3ZfNMSMHpX3erkzyQmHBL4X2o2xjrrDx 3N86fBeRNMYj4Lbc7po8PKtrXR2oLQXQB8a: -0.05000000 Waves 2024.05.07 12:54 [3095591] smart account 3N86fBeRNMYj4Lbc7po8PKtrXR2oLQXQB8a > SELF 0.00000000 Waves
{ "type": 13, "id": "58JxT4m7pynn3ZfNMSMHpX3erkzyQmHBL4X2o2xjrrDx", "fee": 5000000, "feeAssetId": null, "timestamp": 1715075688071, "version": 2, "chainId": 84, "sender": "3N86fBeRNMYj4Lbc7po8PKtrXR2oLQXQB8a", "senderPublicKey": "4uUUD88FFMgtPjui9NEmEstYpUVQNPSLCQw5f8mYHmGz", "proofs": [ "kjBR58vqixkgnmrQWEMfGXj8RsFmCpGNaF5hkkweTqU979fSLHkUcJnKM4hYfnfWiGVoVBSaB1gVbrC8i1xZgSm" ], "script": "base64:BgIECAISAAUADVVTRFRfQVNTRVRfSUQCLDk4RDNwa0t2ZnJYRW5YbVFxS0dXZ3RvR3ZWaDFhVGY0Q1BEdHRxRzljc3VtAA9VU0RUXzJfQVNTRVRfSUQCLDk4RDNwa0t2ZnJYRW5YbVFxS0dXZ3RvR3ZWaDFhVGY0Q1BEdHRxRzljc3VtAA1VU0RDX0FTU0VUX0lEAiw5OEQzcGtLdmZyWEVuWG1RcUtHV2d0b0d2VmgxYVRmNENQRHR0cUc5Y3N1bQAPVVNEQ18yX0FTU0VUX0lEAiw5OEQzcGtLdmZyWEVuWG1RcUtHV2d0b0d2VmgxYVRmNENQRHR0cUc5Y3N1bQAMQkFJX0FTU0VUX0lEAixBeEdLUVJ4S280RjJFYmhyUnE2TjJ0ZExzeHRNbnB6UXNTNFFlbVY2VjFXMQEBaQEDYnV5AAQRV0FWRVNfVVNEVF9PUkFDTEUJARFAZXh0ck5hdGl2ZSgxMDYyKQECIzNOMVdqaG1GM0V5dXR2cnZ0c2ZzU0xiaG1pTFU4QmMxVG95BBVXQVZFU19VU0RUX09SQUNMRV9LRVkCF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VudCBuZWNlc3NhcnkgaW4gV2F2ZXMsIFVTREMgb3IgVVNEVCEJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwUGc2VuZGVyBQZhbW91bnQJANkEAQUMQkFJX0FTU0VUX0lEBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5hlWMyQ==", "height": 3095591, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 56nGfe8qpEVshv5uyxtohtsGrp7tQiAYVnYtqRsYiwVB Next: 2hFcSy1rFF3XKcJ72rGZcCaRLLNwnXASScwmpAJLtEU1 Diff:
Old | New | Differences | |
---|---|---|---|
38 | 38 | case _ => | |
39 | 39 | 0 | |
40 | 40 | } | |
41 | - | (fraction((12 * | |
41 | + | (fraction(paymentAmount, wavesUsdtPrice, (12 * 10000000)) * 10) | |
42 | 42 | } | |
43 | 43 | else if ((feeAssetIdString == USDT_ASSET_ID)) | |
44 | 44 | then fraction(paymentAmount, 1000, 12) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
5 | 5 | ||
6 | 6 | let USDT_2_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
7 | 7 | ||
8 | 8 | let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
9 | 9 | ||
10 | 10 | let USDC_2_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
11 | 11 | ||
12 | 12 | let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1" | |
13 | 13 | ||
14 | 14 | @Callable(i) | |
15 | 15 | func buy () = { | |
16 | 16 | let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy") | |
17 | 17 | let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT" | |
18 | 18 | let numberOfPayments = size(i.payments) | |
19 | 19 | let paymentAssetId = i.payments[0].assetId | |
20 | 20 | let sender = i.caller | |
21 | 21 | if ((numberOfPayments != 1)) | |
22 | 22 | then throw("Payment necessary!") | |
23 | 23 | else { | |
24 | 24 | let payment = i.payments[0] | |
25 | 25 | let feeAssetId = payment.assetId | |
26 | 26 | let feeAssetIdString = match feeAssetId { | |
27 | 27 | case b: ByteVector => | |
28 | 28 | toBase58String(b) | |
29 | 29 | case _ => | |
30 | 30 | "" | |
31 | 31 | } | |
32 | 32 | let paymentAmount = payment.amount | |
33 | 33 | let amount = if (!(isDefined(feeAssetId))) | |
34 | 34 | then { | |
35 | 35 | let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) { | |
36 | 36 | case n: Int => | |
37 | 37 | n | |
38 | 38 | case _ => | |
39 | 39 | 0 | |
40 | 40 | } | |
41 | - | (fraction((12 * | |
41 | + | (fraction(paymentAmount, wavesUsdtPrice, (12 * 10000000)) * 10) | |
42 | 42 | } | |
43 | 43 | else if ((feeAssetIdString == USDT_ASSET_ID)) | |
44 | 44 | then fraction(paymentAmount, 1000, 12) | |
45 | 45 | else if ((feeAssetIdString == USDT_2_ASSET_ID)) | |
46 | 46 | then fraction(paymentAmount, 1000, 12) | |
47 | 47 | else if ((feeAssetIdString == USDC_ASSET_ID)) | |
48 | 48 | then fraction(paymentAmount, 1000, 12) | |
49 | 49 | else if ((feeAssetIdString == USDC_2_ASSET_ID)) | |
50 | 50 | then fraction(paymentAmount, 1000, 12) | |
51 | 51 | else throw("Payment necessary in Waves, USDC or USDT!") | |
52 | 52 | [ScriptTransfer(sender, amount, fromBase58String(BAI_ASSET_ID))] | |
53 | 53 | } | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Verifier(tx) | |
58 | 58 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
59 | 59 |
github/deemru/w8io/026f985 19.82 ms ◑