tx · 4qW4EZjVvZmwS2fuaprXHbBViP5zFwTP95baF4q3FAa2

3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD:  -0.01000000 Waves

2023.08.19 19:38 [2717735] smart account 3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD > SELF 0.00000000 Waves

{ "type": 13, "id": "4qW4EZjVvZmwS2fuaprXHbBViP5zFwTP95baF4q3FAa2", "fee": 1000000, "feeAssetId": null, "timestamp": 1692463121767, "version": 2, "chainId": 84, "sender": "3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD", "senderPublicKey": "G6PnkMn8MpXBkNwsQKMn1o1V7EKMgZyHCJRdFMQuouBC", "proofs": [ "3fLLxyv8VEoAWTbu9KJGZHci8ZPSR9QLPRcYSSnEuPWVTaooYAWpKyCPyfdiS9an6rrVgxLMigk4Q7SWqPUBEfS5" ], "script": "base64:BgIHCAISAwoBCAkAEGNvbnRyYWN0RmlsZU5hbWUCAnAxAA10b2tlbl9hZGRyZXNzCQEHQWRkcmVzcwEBGgFUUevquKc82yLj6POP0d8MGx4c9yM7LkYsAA5QUkFDVElDRV90b2tlbgEgmof7CiKwpMapEnkqALPSW46iVZVhy83sQ1L32dsdwioAA1NFUAIBIAAIa2Fzc2V0SWQCB0Fzc2V0SUQBBmtleU1zZwAJALkJAgkAzAgCAgIlcwkAzAgCAinQn9C10YDQtdC00LDQvdC90L7QtSDRgdC+0L7QsdGJ0LXQvdC40LU6IAUDbmlsBQNTRVABCmtleUFzc2V0SUQACQC5CQIJAMwIAgICJXMJAMwIAgIHYXNzZXRJRAUDbmlsBQNTRVABB3dyYXBFcnIBA21zZwkAuQkCCQDMCAIFEGNvbnRyYWN0RmlsZU5hbWUJAMwIAgIBOgkAzAgCBQNtc2cFA25pbAIAAQh0aHJvd0VycgEDbXNnCQACAQkBB3dyYXBFcnIBBQNtc2cBAWkBB21lc3NhZ2UBA21zZwQFd29yZHMJALUJAgUDbXNnBQNTRVAECXdvcmRDb3VudAkAkAMBBQV3b3JkcwQHcGF5bWVudAkAkQMCCAUBaQhwYXltZW50cwAABA5wYXltZW50X2Ftb3VudAgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQDCQECIT0CBQ5wYXltZW50X2Ftb3VudAUJd29yZENvdW50CQEIdGhyb3dFcnIBAjLQmtC+0Lst0LLQviDRgdC70L7QsiAhPSDQutC+0Lst0LLRgyDRgtC+0LrQtdC90L7QsgMJAAACBQ5QUkFDVElDRV90b2tlbggJAJEDAggFAWkIcGF5bWVudHMAAAdhc3NldElkCQEIdGhyb3dFcnIBAi7Qn9C70LDRgtC10LYg0LTQvtC70LbQtdC9INCx0YvRgtGMINCyIFBSQUNUSUNFCQDMCAIJAQtTdHJpbmdFbnRyeQIJAQZrZXlNc2cABQNtc2cFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkXc94V", "height": 2717735, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DDq4tiUU1CZLkcPDSBJ5XN4FyH56cbEF8wSUxJTKeLCy Next: FvCiQoSmipRdn7nyR7jgc3bjQ5dFKaeqCnXXtNHbNUAc Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let contractFileName = "p1"
55
6-let SEP = "_"
6+let token_address = Address(base58'3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD')
7+
8+let PRACTICE_token = base58'BQE3kUrRJ2nEzsXVeuB1KGBdyRhCHa3fRtSkyTsCJwa1'
9+
10+let SEP = " "
711
812 let kassetId = "AssetID"
913
10-let knewToken = "Token"
14+func keyMsg () = makeString(["%s", "Переданное сообщение: "], SEP)
15+
1116
1217 func keyAssetID () = makeString(["%s", "assetID"], SEP)
13-
14-
15-func keyTx () = makeString(["%s", "purchase: "], SEP)
1618
1719
1820 func wrapErr (msg) = makeString([contractFileName, ":", msg], "")
2224
2325
2426 @Callable(i)
25-func tokenIssuance () = {
26- let name = "PRACTICE"
27- let description = "1:10 waves"
28- let quantity = 10000000
29- let decimals = 0
30- let issue_token = Issue(name, description, quantity, decimals, true)
31- let assetId = calculateAssetId(issue_token)
32-[issue_token, BinaryEntry(kassetId, assetId), StringEntry(knewToken, issue_token.name)]
27+func message (msg) = {
28+ let words = split(msg, SEP)
29+ let wordCount = size(words)
30+ let payment = i.payments[0]
31+ let payment_amount = i.payments[0].amount
32+ if ((payment_amount != wordCount))
33+ then throwErr("Кол-во слов != кол-ву токенов")
34+ else if ((PRACTICE_token == i.payments[0].assetId))
35+ then throwErr("Платеж должен быть в PRACTICE")
36+ else [StringEntry(keyMsg(), msg)]
3337 }
3438
3539
36-
37-@Callable(i)
38-func buyToken (quantity) = {
39- let wavesOrErr = (i.payments[0].assetId == unit)
40- let assetId = valueOrErrorMessage(getBinaryValue(this, kassetId), "id токена не найден")
41- let paymentAmount = i.payments[0].amount
42- let token_price = 10000000
43- let amount_due = (token_price * quantity)
44- let payment = match i.payments[0] {
45- case p: AttachedPayment =>
46- p
47- case _ =>
48- throw("Send exactly 0.1 WAVES")
49- }
50- if ((wavesOrErr != true))
51- then throwErr("Платеж должен быть в WAVES")
52- else if ((paymentAmount != amount_due))
53- then throwErr("Неправильная сумма платежа")
54- else [ScriptTransfer(i.caller, quantity, assetId), IntegerEntry(keyTx(), quantity)]
55- }
56-
40+@Verifier(tx)
41+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5742
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let contractFileName = "p1"
55
6-let SEP = "_"
6+let token_address = Address(base58'3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD')
7+
8+let PRACTICE_token = base58'BQE3kUrRJ2nEzsXVeuB1KGBdyRhCHa3fRtSkyTsCJwa1'
9+
10+let SEP = " "
711
812 let kassetId = "AssetID"
913
10-let knewToken = "Token"
14+func keyMsg () = makeString(["%s", "Переданное сообщение: "], SEP)
15+
1116
1217 func keyAssetID () = makeString(["%s", "assetID"], SEP)
13-
14-
15-func keyTx () = makeString(["%s", "purchase: "], SEP)
1618
1719
1820 func wrapErr (msg) = makeString([contractFileName, ":", msg], "")
1921
2022
2123 func throwErr (msg) = throw(wrapErr(msg))
2224
2325
2426 @Callable(i)
25-func tokenIssuance () = {
26- let name = "PRACTICE"
27- let description = "1:10 waves"
28- let quantity = 10000000
29- let decimals = 0
30- let issue_token = Issue(name, description, quantity, decimals, true)
31- let assetId = calculateAssetId(issue_token)
32-[issue_token, BinaryEntry(kassetId, assetId), StringEntry(knewToken, issue_token.name)]
27+func message (msg) = {
28+ let words = split(msg, SEP)
29+ let wordCount = size(words)
30+ let payment = i.payments[0]
31+ let payment_amount = i.payments[0].amount
32+ if ((payment_amount != wordCount))
33+ then throwErr("Кол-во слов != кол-ву токенов")
34+ else if ((PRACTICE_token == i.payments[0].assetId))
35+ then throwErr("Платеж должен быть в PRACTICE")
36+ else [StringEntry(keyMsg(), msg)]
3337 }
3438
3539
36-
37-@Callable(i)
38-func buyToken (quantity) = {
39- let wavesOrErr = (i.payments[0].assetId == unit)
40- let assetId = valueOrErrorMessage(getBinaryValue(this, kassetId), "id токена не найден")
41- let paymentAmount = i.payments[0].amount
42- let token_price = 10000000
43- let amount_due = (token_price * quantity)
44- let payment = match i.payments[0] {
45- case p: AttachedPayment =>
46- p
47- case _ =>
48- throw("Send exactly 0.1 WAVES")
49- }
50- if ((wavesOrErr != true))
51- then throwErr("Платеж должен быть в WAVES")
52- else if ((paymentAmount != amount_due))
53- then throwErr("Неправильная сумма платежа")
54- else [ScriptTransfer(i.caller, quantity, assetId), IntegerEntry(keyTx(), quantity)]
55- }
56-
40+@Verifier(tx)
41+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5742

github/deemru/w8io/026f985 
21.53 ms