tx · 6xho7p1E1TdEiADkxerHqGWvPNBKjgVDy84XkwWbXJ6E 3N86fBeRNMYj4Lbc7po8PKtrXR2oLQXQB8a: -0.01000000 Waves 2024.03.29 14:42 [3039316] smart account 3N86fBeRNMYj4Lbc7po8PKtrXR2oLQXQB8a > SELF 0.00000000 Waves
{ "type": 13, "id": "6xho7p1E1TdEiADkxerHqGWvPNBKjgVDy84XkwWbXJ6E", "fee": 1000000, "feeAssetId": null, "timestamp": 1711712562579, "version": 2, "chainId": 84, "sender": "3N86fBeRNMYj4Lbc7po8PKtrXR2oLQXQB8a", "senderPublicKey": "4uUUD88FFMgtPjui9NEmEstYpUVQNPSLCQw5f8mYHmGz", "proofs": [ "j7HpNfEU8g8vF12eGKw1igg4zycdBgZYyDQpnQQLDmuP7YnnKKWSrzJ7E1hp7VVY2FNBPvMp5dePucZhxtSnhje" ], "script": "base64:BgIECAISAAIAEUFJX1RPS0VOX0FTU0VUX0lEASCT4XI4cQSbauiaYx8EJLdkU5csPrxmC4N0r2i7JI3iQgELd2hpdGVsaXN0ZWQBB2FkZHJlc3MEByRtYXRjaDAJAJsIAgUEdGhpcwkArAICAgp3aGl0ZWxpc3RfBQdhZGRyZXNzAwkAAQIFByRtYXRjaDACB0Jvb2xlYW4EAWIFByRtYXRjaDAFAWIHAQFpAQNidXkABBFXQVZFU19VU0RUX09SQUNMRQkBEUBleHRyTmF0aXZlKDEwNjIpAQIjM04xV2pobUYzRXl1dHZydnRzZnNTTGJobWlMVThCYzFUb3kEFVdBVkVTX1VTRFRfT1JBQ0xFX0tFWQIXJXMlc19fcHJpY2VfX1dBVkVTLVVTRFQEDVVTRFRfQVNTRVRfSUQCLDk4RDNwa0t2ZnJYRW5YbVFxS0dXZ3RvR3ZWaDFhVGY0Q1BEdHRxRzljc3VtBA1VU0RDX0FTU0VUX0lEAiw5OEQzcGtLdmZyWEVuWG1RcUtHV2d0b0d2VmgxYVRmNENQRHR0cUc5Y3N1bQQMQkFJX0FTU0VUX0lEAixB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FJX0FTU0VUX0lEBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5cZl9Ww==", "height": 3039316, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 58Ytg4pXNEQmAoVaJJ2rBvpHsdDNaZt7HePkNgx2uvy2 Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let AI_TOKEN_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1' | |
5 | + | ||
6 | + | func whitelisted (address) = match getBoolean(this, ("whitelist_" + address)) { | |
7 | + | case b: Boolean => | |
8 | + | b | |
9 | + | case _ => | |
10 | + | false | |
11 | + | } | |
12 | + | ||
13 | + | ||
14 | + | @Callable(i) | |
15 | + | func buy () = { | |
16 | + | let WAVES_USDT_ORACLE = addressFromStringValue("3N1WjhmF3EyutvrvtsfsSLbhmiLU8Bc1Toy") | |
17 | + | let WAVES_USDT_ORACLE_KEY = "%s%s__price__WAVES-USDT" | |
18 | + | let USDT_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
19 | + | let USDC_ASSET_ID = "98D3pkKvfrXEnXmQqKGWgtoGvVh1aTf4CPDttqG9csum" | |
20 | + | let BAI_ASSET_ID = "AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1" | |
21 | + | let numberOfPayments = size(i.payments) | |
22 | + | let sender = i.caller | |
23 | + | if (!(whitelisted(toString(sender)))) | |
24 | + | then throw("Address not whitelisted!") | |
25 | + | else if ((numberOfPayments != 1)) | |
26 | + | then throw("Payment necessary!") | |
27 | + | else { | |
28 | + | let payment = i.payments[0] | |
29 | + | let feeAssetId = payment.assetId | |
30 | + | let feeAssetIdString = match feeAssetId { | |
31 | + | case b: ByteVector => | |
32 | + | toBase58String(b) | |
33 | + | case _ => | |
34 | + | "" | |
35 | + | } | |
36 | + | let paymentAmount = payment.amount | |
37 | + | let amount = if (!(isDefined(feeAssetId))) | |
38 | + | then { | |
39 | + | let wavesUsdtPrice = match getInteger(WAVES_USDT_ORACLE, WAVES_USDT_ORACLE_KEY) { | |
40 | + | case n: Int => | |
41 | + | n | |
42 | + | case _ => | |
43 | + | 0 | |
44 | + | } | |
45 | + | (fraction(paymentAmount, wavesUsdtPrice, 100000000) * 100) | |
46 | + | } | |
47 | + | else if ((feeAssetIdString == USDT_ASSET_ID)) | |
48 | + | then (paymentAmount * 100) | |
49 | + | else if ((feeAssetIdString == USDC_ASSET_ID)) | |
50 | + | then (paymentAmount * 100) | |
51 | + | else throw("payment necessary in Waves, USDC or USDT!") | |
52 | + | [ScriptTransfer(sender, amount, fromBase58String(BAI_ASSET_ID))] | |
53 | + | } | |
54 | + | } | |
55 | + | ||
56 | + | ||
57 | + | @Verifier(tx) | |
58 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
59 | + |
github/deemru/w8io/026f985 12.35 ms ◑