tx · HNFiK4DVdTF96inySdDf3SUpqc7PaxCi1KpSFAk6QyJd 3N86fBeRNMYj4Lbc7po8PKtrXR2oLQXQB8a: -0.05000000 Waves 2024.05.07 08:49 [3095351] smart account 3N86fBeRNMYj4Lbc7po8PKtrXR2oLQXQB8a > SELF 0.00000000 Waves
{ "type": 13, "id": "HNFiK4DVdTF96inySdDf3SUpqc7PaxCi1KpSFAk6QyJd", "fee": 5000000, "feeAssetId": null, "timestamp": 1715061044470, "version": 2, "chainId": 84, "sender": "3N86fBeRNMYj4Lbc7po8PKtrXR2oLQXQB8a", "senderPublicKey": "4uUUD88FFMgtPjui9NEmEstYpUVQNPSLCQw5f8mYHmGz", "proofs": [ "4szi7aTUZSnJGXyKMsCMeANfdJJVYh1ByVryH9211fWPWsU4tabW3HihKFzHVTWyQ4BhYvVvxppcDbWQ4GYq6Ag9" ], "script": "base64:BgIECAISAAUADVVTRFRfQVNTRVRfSUQCLEc1V1dXenpWc1dSeXpHZjMyeG9qYm5mcDdnWGJXcmdxSlQ4UmNWV0VmTG1DAA9VU0RUXzJfQVNTRVRfSUQCLDl3YzNMWE5BNFRFQnNYeUt0b0xFOW1yYkREN1dNSFh2WHJDalp2YWJMQXNpAA1VU0RDX0FTU0VUX0lEAiwzYXlIM1BoV01raEZzeVNzVVZjQzhCdkZmMVF5eEdCNUJadVRQeVZ0bVA0dgAPVVNEQ18yX0FTU0VUX0lEAixIR2dhYlRxVVM4V3RWRlVKemZtclRETWdFY2NKdVpMQlBoRmdRRnh2bnNvVwAMQkFJX0FTU0VUX0lEAiwyZmR6eUh2WEdDcWF6MVhBOG05Zm9kZW1tUDlnaVZCY3BlNEpxOUY2M29GTAEBaQEDYnV5AAQRV0FWRVNfVVNEVF9PUkFDTEUJARFAZXh0ck5hdGl2ZSgxMDYyKQECIzNQS2tvaktkZDZCQnpUZjFSWGJRVmZVRHJhTkZYWEhLelFGBBVXQVZFU19VU0RUX09SQUNMRV9LRVkCFyVzJXNfX3ByaWNlX19XQ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gV2F2ZXMsIFVTREMgb3IgVVNEVCEJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwUGc2VuZGVyBQZhbW91bnQJANkEAQUMQkFJX0FTU0VUX0lEBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5jU60bg==", "height": 3095351, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AmryZXF89oZzi6XkVbpD9bXHMrGdBwSWeyG2SS67ZAFw Next: F8Sh4zvnU2i9wMHFHgMM9dubtRcFqHrbMvSSahRgK8j8 Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let USDT_ASSET_ID = " | |
4 | + | let USDT_ASSET_ID = "G5WWWzzVsWRyzGf32xojbnfp7gXbWrgqJT8RcVWEfLmC" | |
5 | 5 | ||
6 | - | let USDT_2_ASSET_ID = " | |
6 | + | let USDT_2_ASSET_ID = "9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi" | |
7 | 7 | ||
8 | - | let USDC_ASSET_ID = " | |
8 | + | let USDC_ASSET_ID = "3ayH3PhWMkhFsySsUVcC8BvFf1QyxGB5BZuTPyVtmP4v" | |
9 | 9 | ||
10 | - | let USDC_2_ASSET_ID = " | |
10 | + | let USDC_2_ASSET_ID = "HGgabTqUS8WtVFUJzfmrTDMgEccJuZLBPhFgQFxvnsoW" | |
11 | 11 | ||
12 | - | let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1" | |
13 | - | ||
14 | - | func whitelisted (address) = match getBoolean(this, ("whitelist_" + address)) { | |
15 | - | case b: Boolean => | |
16 | - | b | |
17 | - | case _ => | |
18 | - | false | |
19 | - | } | |
20 | - | ||
12 | + | let BAI_ASSET_ID = "2fdzyHvXGCqaz1XA8m9fodemmP9giVBcpe4Jq9F63oFL" | |
21 | 13 | ||
22 | 14 | @Callable(i) | |
23 | 15 | func buy () = { | |
24 | - | let WAVES_USDT_ORACLE = addressFromStringValue(" | |
16 | + | let WAVES_USDT_ORACLE = addressFromStringValue("3PKkojKdd6BBzTf1RXbQVfUDraNFXXHKzQF") | |
25 | 17 | let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT" | |
26 | 18 | let numberOfPayments = size(i.payments) | |
27 | 19 | let paymentAssetId = i.payments[0].assetId | |
28 | 20 | let sender = i.caller | |
29 | - | if (!(whitelisted(toString(sender)))) | |
30 | - | then throw("Address not whitelisted!") | |
31 | - | else if ((numberOfPayments != 1)) | |
32 | - | then throw("Payment necessary!") | |
33 | - | else { | |
34 | - | let payment = i.payments[0] | |
35 | - | let feeAssetId = payment.assetId | |
36 | - | let feeAssetIdString = match feeAssetId { | |
37 | - | case b: ByteVector => | |
38 | - | toBase58String(b) | |
39 | - | case _ => | |
40 | - | "" | |
41 | - | } | |
42 | - | let paymentAmount = payment.amount | |
43 | - | let amount = if (!(isDefined(feeAssetId))) | |
44 | - | then { | |
45 | - | let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) { | |
46 | - | case n: Int => | |
47 | - | n | |
48 | - | case _ => | |
49 | - | 0 | |
50 | - | } | |
51 | - | (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100) | |
52 | - | } | |
53 | - | else if ((feeAssetIdString == USDT_ASSET_ID)) | |
54 | - | then (paymentAmount * 100) | |
55 | - | else if ((feeAssetIdString == USDT_2_ASSET_ID)) | |
56 | - | then (paymentAmount * 100) | |
57 | - | else if ((feeAssetIdString == USDC_ASSET_ID)) | |
58 | - | then (paymentAmount * 100) | |
59 | - | else if ((feeAssetIdString == USDC_2_ASSET_ID)) | |
60 | - | then (paymentAmount * 100) | |
61 | - | else throw("Payment necessary in Waves, USDC or USDT!") | |
21 | + | if ((numberOfPayments != 1)) | |
22 | + | then throw("Payment necessary!") | |
23 | + | else { | |
24 | + | let payment = i.payments[0] | |
25 | + | let feeAssetId = payment.assetId | |
26 | + | let feeAssetIdString = match feeAssetId { | |
27 | + | case b: ByteVector => | |
28 | + | toBase58String(b) | |
29 | + | case _ => | |
30 | + | "" | |
31 | + | } | |
32 | + | let paymentAmount = payment.amount | |
33 | + | let amount = if (!(isDefined(feeAssetId))) | |
34 | + | then { | |
35 | + | let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) { | |
36 | + | case n: Int => | |
37 | + | n | |
38 | + | case _ => | |
39 | + | 0 | |
40 | + | } | |
41 | + | (fraction((12 * paymentAmount), wavesUsdtPrice, 100000000) * 10) | |
42 | + | } | |
43 | + | else if ((feeAssetIdString == USDT_ASSET_ID)) | |
44 | + | then fraction(paymentAmount, 1000, 12) | |
45 | + | else if ((feeAssetIdString == USDT_2_ASSET_ID)) | |
46 | + | then fraction(paymentAmount, 1000, 12) | |
47 | + | else if ((feeAssetIdString == USDC_ASSET_ID)) | |
48 | + | then fraction(paymentAmount, 1000, 12) | |
49 | + | else if ((feeAssetIdString == USDC_2_ASSET_ID)) | |
50 | + | then fraction(paymentAmount, 1000, 12) | |
51 | + | else throw("Payment necessary in Waves, USDC or USDT!") | |
62 | 52 | [ScriptTransfer(sender, amount, fromBase58String(BAI_ASSET_ID))] | |
63 | - | ||
53 | + | } | |
64 | 54 | } | |
65 | 55 | ||
66 | 56 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let USDT_ASSET_ID = " | |
4 | + | let USDT_ASSET_ID = "G5WWWzzVsWRyzGf32xojbnfp7gXbWrgqJT8RcVWEfLmC" | |
5 | 5 | ||
6 | - | let USDT_2_ASSET_ID = " | |
6 | + | let USDT_2_ASSET_ID = "9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi" | |
7 | 7 | ||
8 | - | let USDC_ASSET_ID = " | |
8 | + | let USDC_ASSET_ID = "3ayH3PhWMkhFsySsUVcC8BvFf1QyxGB5BZuTPyVtmP4v" | |
9 | 9 | ||
10 | - | let USDC_2_ASSET_ID = " | |
10 | + | let USDC_2_ASSET_ID = "HGgabTqUS8WtVFUJzfmrTDMgEccJuZLBPhFgQFxvnsoW" | |
11 | 11 | ||
12 | - | let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1" | |
13 | - | ||
14 | - | func whitelisted (address) = match getBoolean(this, ("whitelist_" + address)) { | |
15 | - | case b: Boolean => | |
16 | - | b | |
17 | - | case _ => | |
18 | - | false | |
19 | - | } | |
20 | - | ||
12 | + | let BAI_ASSET_ID = "2fdzyHvXGCqaz1XA8m9fodemmP9giVBcpe4Jq9F63oFL" | |
21 | 13 | ||
22 | 14 | @Callable(i) | |
23 | 15 | func buy () = { | |
24 | - | let WAVES_USDT_ORACLE = addressFromStringValue(" | |
16 | + | let WAVES_USDT_ORACLE = addressFromStringValue("3PKkojKdd6BBzTf1RXbQVfUDraNFXXHKzQF") | |
25 | 17 | let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT" | |
26 | 18 | let numberOfPayments = size(i.payments) | |
27 | 19 | let paymentAssetId = i.payments[0].assetId | |
28 | 20 | let sender = i.caller | |
29 | - | if (!(whitelisted(toString(sender)))) | |
30 | - | then throw("Address not whitelisted!") | |
31 | - | else if ((numberOfPayments != 1)) | |
32 | - | then throw("Payment necessary!") | |
33 | - | else { | |
34 | - | let payment = i.payments[0] | |
35 | - | let feeAssetId = payment.assetId | |
36 | - | let feeAssetIdString = match feeAssetId { | |
37 | - | case b: ByteVector => | |
38 | - | toBase58String(b) | |
39 | - | case _ => | |
40 | - | "" | |
41 | - | } | |
42 | - | let paymentAmount = payment.amount | |
43 | - | let amount = if (!(isDefined(feeAssetId))) | |
44 | - | then { | |
45 | - | let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) { | |
46 | - | case n: Int => | |
47 | - | n | |
48 | - | case _ => | |
49 | - | 0 | |
50 | - | } | |
51 | - | (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100) | |
52 | - | } | |
53 | - | else if ((feeAssetIdString == USDT_ASSET_ID)) | |
54 | - | then (paymentAmount * 100) | |
55 | - | else if ((feeAssetIdString == USDT_2_ASSET_ID)) | |
56 | - | then (paymentAmount * 100) | |
57 | - | else if ((feeAssetIdString == USDC_ASSET_ID)) | |
58 | - | then (paymentAmount * 100) | |
59 | - | else if ((feeAssetIdString == USDC_2_ASSET_ID)) | |
60 | - | then (paymentAmount * 100) | |
61 | - | else throw("Payment necessary in Waves, USDC or USDT!") | |
21 | + | if ((numberOfPayments != 1)) | |
22 | + | then throw("Payment necessary!") | |
23 | + | else { | |
24 | + | let payment = i.payments[0] | |
25 | + | let feeAssetId = payment.assetId | |
26 | + | let feeAssetIdString = match feeAssetId { | |
27 | + | case b: ByteVector => | |
28 | + | toBase58String(b) | |
29 | + | case _ => | |
30 | + | "" | |
31 | + | } | |
32 | + | let paymentAmount = payment.amount | |
33 | + | let amount = if (!(isDefined(feeAssetId))) | |
34 | + | then { | |
35 | + | let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) { | |
36 | + | case n: Int => | |
37 | + | n | |
38 | + | case _ => | |
39 | + | 0 | |
40 | + | } | |
41 | + | (fraction((12 * paymentAmount), wavesUsdtPrice, 100000000) * 10) | |
42 | + | } | |
43 | + | else if ((feeAssetIdString == USDT_ASSET_ID)) | |
44 | + | then fraction(paymentAmount, 1000, 12) | |
45 | + | else if ((feeAssetIdString == USDT_2_ASSET_ID)) | |
46 | + | then fraction(paymentAmount, 1000, 12) | |
47 | + | else if ((feeAssetIdString == USDC_ASSET_ID)) | |
48 | + | then fraction(paymentAmount, 1000, 12) | |
49 | + | else if ((feeAssetIdString == USDC_2_ASSET_ID)) | |
50 | + | then fraction(paymentAmount, 1000, 12) | |
51 | + | else throw("Payment necessary in Waves, USDC or USDT!") | |
62 | 52 | [ScriptTransfer(sender, amount, fromBase58String(BAI_ASSET_ID))] | |
63 | - | ||
53 | + | } | |
64 | 54 | } | |
65 | 55 | ||
66 | 56 | ||
67 | 57 | @Verifier(tx) | |
68 | 58 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
69 | 59 |
github/deemru/w8io/026f985 22.17 ms ◑