tx · CxfqokVSSjfXo646AMaNBEzqD3b1HDSeZLxm88pHfr7N 3NBkgZNDiBMcfaXFzTjyRjhPmSzPwNEESfT: -0.01000000 Waves 2023.10.11 06:53 [2793443] smart account 3NBkgZNDiBMcfaXFzTjyRjhPmSzPwNEESfT > SELF 0.00000000 Waves
{ "type": 13, "id": "CxfqokVSSjfXo646AMaNBEzqD3b1HDSeZLxm88pHfr7N", "fee": 1000000, "feeAssetId": null, "timestamp": 1696996488485, "version": 2, "chainId": 84, "sender": "3NBkgZNDiBMcfaXFzTjyRjhPmSzPwNEESfT", "senderPublicKey": "FjhtNLcQF3PqRymjVvNo3MP7GkwACEUWicnD6uHx8p7g", "proofs": [ "4tkfuqHjxHZmWzBp8Lz2cTb3RukrMWSYNrAjNYgNHxCDhqowFPfvm6syaPFY3mbCRWf3hWTmVyC7LtkDW6BHdp8q" ], "script": "base64:BgIOCAISBAoCCAgSBAoCCAERAQ5nZXRTdHJpbmdCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCdCAIFBHRoaXMFA2tleQIAABF1c2R0UFBBc3NldElkX3N0cgkBDmdldFN0cmluZ0J5S2V5AQIbY29uZl9hY2NlcHRlZF9hc3NldF9VU0RUX1BQAA5hcnRBc3NldElkX3N0cgkBDmdldFN0cmluZ0J5S2V5AQIXY29uZl9hY2NlcHRlZF9hc3NldF9BUlQAEXVzZGNQUEFzc2V0SWRfc3RyCQEOZ2V0U3RyaW5nQnlLZXkBAhtjb25mX2FjY2VwdGVkX2Fzc2V0X1VTRENfUFAAD2Vhc3RBc3NldElkX3N0cgkBDmdldFN0cmluZ0J5S2V5AQIYY29uZl9hY2NlcHRlZF9hc3NldF9FQVNUABFwdXp6bGVBc3NldElkX3N0cgkBDmdldFN0cmluZ0J5S2V5AQIaY29uZl9hY2NlcHRlZF9hc3NldF9QVVpaTEUAEGV0aFBQQXNzZXRJZF9zdHIJAQ5nZXRTdHJpbmdCeUtleQECGmNvbmZfYWNjZXB0ZWRfYXNzZXRf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c3NldE91dAxNaW5BbW91bnRPdXQEB3BheW1lbnQJAQV2YWx1ZQEJAJEDAggFAWkIcGF5bWVudHMAAAQIYW1vdW50SW4JAQV2YWx1ZQEIBQdwYXltZW50BmFtb3VudAQJYXNzZXRJZEluAwkBCWlzRGVmaW5lZAEIBQdwYXltZW50B2Fzc2V0SWQJANgEAQkBBXZhbHVlAQgFB3BheW1lbnQHYXNzZXRJZAIFV0FWRVMDCQECIT0CBQhhc3NldE91dAUOYXJ0QXNzZXRJZF9zdHIJAAIBAhZBc3NldCBvdXQgbm90IGFjY2VwdGVkBAxhbW91bnRUb1NlbmQJARJnZXRfYW1vdW50X3RvX3NlbmQCBQhhbW91bnRJbgUJYXNzZXRJZEluCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUMYW1vdW50VG9TZW5kCQDZBAEFCGFzc2V0T3V0BQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5mY2P+A==", "height": 2793443, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 66vAWLEL7bkM3AgjWYRVZTJW1E6VKKusEB714yJx9Hai Next: none Diff:
Old | New | Differences | |
---|---|---|---|
63 | 63 | func swap (assetOut,MinAmountOut) = { | |
64 | 64 | let payment = value(i.payments[0]) | |
65 | 65 | let amountIn = value(payment.amount) | |
66 | - | let assetIdIn = value(payment.assetId) | |
66 | + | let assetIdIn = if (isDefined(payment.assetId)) | |
67 | + | then toBase58String(value(payment.assetId)) | |
68 | + | else "WAVES" | |
67 | 69 | if ((assetOut != artAssetId_str)) | |
68 | 70 | then throw("Asset out not accepted") | |
69 | 71 | else { | |
70 | - | let amountToSend = get_amount_to_send(amountIn, | |
72 | + | let amountToSend = get_amount_to_send(amountIn, assetIdIn) | |
71 | 73 | [ScriptTransfer(i.caller, amountToSend, fromBase58String(assetOut))] | |
72 | 74 | } | |
73 | 75 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | let usdtPPAssetId_str = getStringByKey("conf_accepted_asset_USDT_PP") | |
8 | 8 | ||
9 | 9 | let artAssetId_str = getStringByKey("conf_accepted_asset_ART") | |
10 | 10 | ||
11 | 11 | let usdcPPAssetId_str = getStringByKey("conf_accepted_asset_USDC_PP") | |
12 | 12 | ||
13 | 13 | let eastAssetId_str = getStringByKey("conf_accepted_asset_EAST") | |
14 | 14 | ||
15 | 15 | let puzzleAssetId_str = getStringByKey("conf_accepted_asset_PUZZLE") | |
16 | 16 | ||
17 | 17 | let ethPPAssetId_str = getStringByKey("conf_accepted_asset_ETH_PP") | |
18 | 18 | ||
19 | 19 | let wavesAssetId_str = "WAVES" | |
20 | 20 | ||
21 | 21 | let usdtPPAssetId = fromBase58String(usdtPPAssetId_str) | |
22 | 22 | ||
23 | 23 | let artAssetId = fromBase58String(artAssetId_str) | |
24 | 24 | ||
25 | 25 | let usdcPPAssetId = fromBase58String(usdcPPAssetId_str) | |
26 | 26 | ||
27 | 27 | let eastAssetId = fromBase58String(eastAssetId_str) | |
28 | 28 | ||
29 | 29 | let puzzleAssetId = fromBase58String(puzzleAssetId_str) | |
30 | 30 | ||
31 | 31 | let ethPPAssetId = fromBase58String(ethPPAssetId_str) | |
32 | 32 | ||
33 | 33 | let wavesAssetId = base58'' | |
34 | 34 | ||
35 | 35 | let chris = getStringByKey("conf_admin_1") | |
36 | 36 | ||
37 | 37 | func get_amount_to_send (amountIn,assetIdIn) = if (if (if ((assetIdIn == usdtPPAssetId_str)) | |
38 | 38 | then true | |
39 | 39 | else (assetIdIn == usdcPPAssetId_str)) | |
40 | 40 | then true | |
41 | 41 | else (assetIdIn == eastAssetId_str)) | |
42 | 42 | then 200000000 | |
43 | 43 | else if ((assetIdIn == puzzleAssetId_str)) | |
44 | 44 | then 800000000 | |
45 | 45 | else if ((assetIdIn == ethPPAssetId_str)) | |
46 | 46 | then 16000000000 | |
47 | 47 | else 300000000 | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | @Callable(invoke) | |
51 | 51 | func setConf (key,val) = { | |
52 | 52 | let caller = toString(invoke.caller) | |
53 | 53 | if (containsElement([chris, toString(this)], caller)) | |
54 | 54 | then if (contains(key, "conf_")) | |
55 | 55 | then [StringEntry(key, val)] | |
56 | 56 | else throw("Entries starting with conf_ only") | |
57 | 57 | else throw("You are not allowed to change this") | |
58 | 58 | } | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | ||
62 | 62 | @Callable(i) | |
63 | 63 | func swap (assetOut,MinAmountOut) = { | |
64 | 64 | let payment = value(i.payments[0]) | |
65 | 65 | let amountIn = value(payment.amount) | |
66 | - | let assetIdIn = value(payment.assetId) | |
66 | + | let assetIdIn = if (isDefined(payment.assetId)) | |
67 | + | then toBase58String(value(payment.assetId)) | |
68 | + | else "WAVES" | |
67 | 69 | if ((assetOut != artAssetId_str)) | |
68 | 70 | then throw("Asset out not accepted") | |
69 | 71 | else { | |
70 | - | let amountToSend = get_amount_to_send(amountIn, | |
72 | + | let amountToSend = get_amount_to_send(amountIn, assetIdIn) | |
71 | 73 | [ScriptTransfer(i.caller, amountToSend, fromBase58String(assetOut))] | |
72 | 74 | } | |
73 | 75 | } | |
74 | 76 | ||
75 | 77 | ||
76 | 78 | @Verifier(tx) | |
77 | 79 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
78 | 80 |
github/deemru/w8io/169f3d6 38.03 ms ◑