tx · 5MmQnKSoVnPuQL7P6rabxKihj6ZWK9T4jcAv9Uh9GCi7 3N7KcuNZ2Pe7hakkyJhJqg63fTZdxPnSX4n: -0.01000000 Waves 2022.05.22 05:46 [2062309] smart account 3N7KcuNZ2Pe7hakkyJhJqg63fTZdxPnSX4n > SELF 0.00000000 Waves
{ "type": 13, "id": "5MmQnKSoVnPuQL7P6rabxKihj6ZWK9T4jcAv9Uh9GCi7", "fee": 1000000, "feeAssetId": null, "timestamp": 1653187614192, "version": 2, "chainId": 84, "sender": "3N7KcuNZ2Pe7hakkyJhJqg63fTZdxPnSX4n", "senderPublicKey": "DohVVD3Qvdzb87xgN5f6HTwkopRNUzEXYmooZ7VqgAbP", "proofs": [ "5WAptFmCEeBTYn7Vuh6YPoLkE1RhQfHRWMVo9C69WC3yESywpV9qkSfk2Qm8LxDqzWXfpnJNNaJBdfj3zyX6u8iE" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIIAQAAAAMAAAAAF0RFQ0lNQUxfUE9JTlRTX0lOX1RPS0VOAAAAAAAAD0JAAAAAAAdVU0ROX0lEAQAAACCMzUgMLnJkPY4/IB9ub3HYe/HmIkiLCcBrVjQQxAnUWgAAAAADV1ZTAAAAAAAF9eEAAAAAAQAAAAFpAQAAAARzd2FwAAAAAgAAAAlyb3V0ZXNTdHIAAAAMbWluVG9SZWNlaXZlBAAAAA1jYWxsZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAA3BtdAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAGYW1vdW50CAUAAAADcG10AAAABmFtb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACBQAAAA1jYWxsZXJBZGRyZXNzAgAAAAxfc3dhcEFtb3VudF8JAABrAAAAAwUAAAAGYW1vdW50BQAAABdERUNJTUFMX1BPSU5UU19JTl9UT0tFTgUAAAADV1ZTCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAAAV2YWx1ZQAAAAEJAAQmAAAAAQUAAAANY2FsbGVyQWRkcmVzcwkAAGsAAAADBQAAAAZhbW91bnQFAAAAF0RFQ0lNQUxfUE9JTlRTX0lOX1RPS0VOBQAAAANXVlMFAAAAB1VTRE5fSUQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5+aVvvw==", "height": 2062309, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: H6ETtdrTrWoX6swbVkLfTb8n5UAzwJLhgiP9tfB1CWxN Next: DifXZ6b2MDUn6WyHqYxqdMkksbc48yfbVj7MjS2zbXww Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let DECIMAL_POINTS_IN_TOKEN = 1000000 | |
5 | 5 | ||
6 | - | let | |
6 | + | let USDN_ID = base58'AUddX5CKUwoa6G414ERDiV1kbUQzz8A7fCVuLhwVW7cD' | |
7 | 7 | ||
8 | - | func getAnswer (question,previousAnswer) = { | |
9 | - | let hash = sha256(toBytes((question + previousAnswer))) | |
10 | - | let index = toInt(hash) | |
11 | - | answers[(index % answersCount)] | |
8 | + | let WVS = 100000000 | |
9 | + | ||
10 | + | @Callable(i) | |
11 | + | func swap (routesStr,minToReceive) = { | |
12 | + | let callerAddress = toBase58String(i.caller.bytes) | |
13 | + | let pmt = value(i.payments[0]) | |
14 | + | let amount = pmt.amount | |
15 | + | [IntegerEntry((callerAddress + "_swapAmount_"), fraction(amount, DECIMAL_POINTS_IN_TOKEN, WVS)), ScriptTransfer(value(addressFromString(callerAddress)), fraction(amount, DECIMAL_POINTS_IN_TOKEN, WVS), USDN_ID)] | |
12 | 16 | } | |
13 | 17 | ||
14 | 18 | ||
15 | - | func getPreviousAnswer (address) = match getString(this, (address + "_a")) { | |
16 | - | case a: String => | |
17 | - | a | |
18 | - | case _ => | |
19 | - | address | |
20 | - | } | |
21 | - | ||
22 | - | ||
23 | - | @Callable(i) | |
24 | - | func tellme (question) = { | |
25 | - | let a = extract(i.payment) | |
26 | - | let b = a.amount | |
27 | - | let callerAddress = toBase58String(i.caller.bytes) | |
28 | - | let answer = getAnswer(question, getPreviousAnswer(callerAddress)) | |
29 | - | WriteSet([DataEntry((callerAddress + "_q"), question), DataEntry((callerAddress + "_a"), answer)]) | |
30 | - | } | |
31 | - | ||
19 | + | @Verifier(tx) | |
20 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
32 | 21 |
github/deemru/w8io/026f985 27.12 ms ◑