tx · H7EoZQaVRL8HDV2fYEhUCntuXMkVVhMz16qvorG1PB8D 3Ms7bYkaAcmqLeUpYEENY9iyspidQjtRjwT: -0.01000000 Waves 2023.05.27 20:47 [2596692] smart account 3Ms7bYkaAcmqLeUpYEENY9iyspidQjtRjwT > SELF 0.00000000 Waves
{ "type": 13, "id": "H7EoZQaVRL8HDV2fYEhUCntuXMkVVhMz16qvorG1PB8D", "fee": 1000000, "feeAssetId": null, "timestamp": 1685209700523, "version": 2, "chainId": 84, "sender": "3Ms7bYkaAcmqLeUpYEENY9iyspidQjtRjwT", "senderPublicKey": "CFMpQ5j4gCMWsbFcF1wZyr4EeuhsKrdq1W3zSiQBjDvG", "proofs": [ "3mcPqMC8HuRyFw2W4nJaiRBWDAVeiirBK4Lo4nZu5MD29hJ8qdbtXUQfXqP8keVozyGHUPX1nFbM9wcwpf7UYbsg" ], "script": "base64:BgIICAISBAoCCAEAAQFpAQRzd2FwAgZfdG9rZW4KX21pbkFtb3VudAQHX2Ftb3VudAgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQEFWZyb21Bc3NldEluZm9EZWNpbWFscwMJAQlpc0RlZmluZWQBCAkAkQMCCAUBaQhwYXltZW50cwAAB2Fzc2V0SWQICQEFdmFsdWUBCQDsBwEJAQV2YWx1ZQEICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAhkZWNpbWFscwAIBBN0b0Fzc2V0SW5mb0RlY2ltYWxzCAkBBXZhbHVlAQkA7AcBCQDZBAEFBl90b2tlbghkZWNpbWFscwQLZGVjaW1hbERpZmYJAGUCBRN0b0Fzc2V0SW5mb0RlY2ltYWxzBRVmcm9tQXNzZXRJbmZvRGVjaW1hbHMEDHJlc3VsdEFtb3VudAMJAAACBQtkZWNpbWFsRGlmZgACCQBoAgUHX2Ftb3VudABkAwkAAAIFC2RlY2ltYWxEaWZmAP7//////////wEJAGkCBQdfYW1vdW50AGQDCQAAAgULZGVjaW1hbERpZmYAAAUHX2Ftb3VudAkAAgECFEludmFsaWQgZGVjaW1hbCBkaWZmCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUMcmVzdWx0QW1vdW50CQDZBAEFBl90b2tlbgUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleR73+aY=", "height": 2596692, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func swap (_token,_minAmount) = { | |
8 | + | let _amount = i.payments[0].amount | |
9 | + | let fromAssetInfoDecimals = if (isDefined(i.payments[0].assetId)) | |
10 | + | then value(assetInfo(value(i.payments[0].assetId))).decimals | |
11 | + | else 8 | |
12 | + | let toAssetInfoDecimals = value(assetInfo(fromBase58String(_token))).decimals | |
13 | + | let decimalDiff = (toAssetInfoDecimals - fromAssetInfoDecimals) | |
14 | + | let resultAmount = if ((decimalDiff == 2)) | |
15 | + | then (_amount * 100) | |
16 | + | else if ((decimalDiff == -2)) | |
17 | + | then (_amount / 100) | |
18 | + | else if ((decimalDiff == 0)) | |
19 | + | then _amount | |
20 | + | else throw("Invalid decimal diff") | |
21 | + | [ScriptTransfer(i.caller, resultAmount, fromBase58String(_token))] | |
22 | + | } | |
23 | + | ||
24 | + | ||
25 | + | @Verifier(tx) | |
26 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
27 | + |
github/deemru/w8io/026f985 16.15 ms ◑