tx · 6jNf2mEm59njtQS9CdK2AUVdRztDYFyE3yDEEfufyXj3 3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD: -0.01000000 Waves 2023.07.30 12:46 [2688436] smart account 3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD > SELF 0.00000000 Waves
{ "type": 13, "id": "6jNf2mEm59njtQS9CdK2AUVdRztDYFyE3yDEEfufyXj3", "fee": 1000000, "feeAssetId": null, "timestamp": 1690710427151, "version": 2, "chainId": 84, "sender": "3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD", "senderPublicKey": "G6PnkMn8MpXBkNwsQKMn1o1V7EKMgZyHCJRdFMQuouBC", "proofs": [ "37opDBR6E8AdbeQuHf8bphx4Tm6sgmoAoqe4SGpDJUWXopteWtpp9ojpJY9VdpA6EViv9T6gU7psNeeQw5QwYhfo" ], "script": "base64:BgIJCAISABIDCgEBBwAQY29udHJhY3RGaWxlTmFtZQICcDEAA1NFUAIBXwAIa2Fzc2V0SWQCB0Fzc2V0SUQACWtuZXdUb2tlbgIFVG9rZW4BCmtleUFzc2V0SUQACQC5CQIJAMwIAgICJXMJAMwIAgIHYXNzZXRJRAUDbmlsBQNTRVABB3dyYXBFcnIBA21zZwkAuQkCCQDMCAIFEGNvbnRyYWN0RmlsZU5hbWUJAMwIAgIBOgkAzAgCBQNtc2cFA25pbAIAAQh0aHJvd0VycgEDbXNnCQACAQkBB3dyYXBFcnIBBQNtc2cCAWkBDXRva2VuSXNzdWFuY2UABARuYW1lAghQUkFDVElDRQQLZGVzY3JpcHRpb24CCjE6MTAgd2F2ZXMECHF1YW50aXR5AICt4gQECGRlY2ltYWxzAAMEC2lzc3VlX3Rva2VuCQDCCAUFBG5hbWUFC2Rlc2NyaXB0aW9uBQhxdWFudGl0eQUIZGVjaW1hbHMGBAdhc3NldElkCQC4CAEFC2lzc3VlX3Rva2VuCQDMCAIFC2lzc3VlX3Rva2VuCQDMCAIJAQtCaW5hcnlFbnRyeQIFCGthc3NldElkBQdhc3NldElkCQDMCAIJAQtTdHJpbmdFbnRyeQIFCWtuZXdUb2tlbggFC2lzc3VlX3Rva2VuBG5hbWUFA25pbAFpAQhidXlUb2tlbgEIcXVhbnRpdHkECndhdmVzT3JFcnIJAAACCAkAkQMCCAUBaQhwYXltZW50cwAAB2Fzc2V0SWQFBHVuaXQEB2Fzc2V0SWQJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkBEUBleHRyTmF0aXZlKDEwNTIpAgUEdGhpcwUIa2Fzc2V0SWQCIWlkINGC0L7QutC10L3QsCDQvdC1INC90LDQudC00LXQvQQNcGF5bWVudEFtb3VudAgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQEC3Rva2VuX3ByaWNlAKCNBgQKYW1vdW50X2R1ZQkAaAIFC3Rva2VuX3ByaWNlBQhxdWFudGl0eQQHcGF5bWVudAQHJG1hdGNoMAkAkQMCCAUBaQhwYXltZW50cwAAAwkAAQIFByRtYXRjaDACD0F0dGFjaGVkUGF5bWVudAQBcAUHJG1hdGNoMAUBcAkAAgECFlNlbmQgZXhhY3RseSAwLjEgV0FWRVMDCQECIT0CBQp3YXZlc09yRXJyBgkBCHRocm93RXJyAQIr0J/Qu9Cw0YLQtdC2INC00L7Qu9C20LXQvSDQsdGL0YLRjCDQsiBXQVZFUwMJAAACBQ1wYXltZW50QW1vdW50BQphbW91bnRfZHVlCQEIdGhyb3dFcnIBAjLQndC10L/RgNCw0LLQuNC70YzQvdCw0Y8g0YHRg9C80LzQsCDQv9C70LDRgtC10LbQsAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFCHF1YW50aXR5BQdhc3NldElkBQNuaWwA2og/Bg==", "height": 2688436, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 73KbMpTwPmqMtA1Z1pz7tZjeQsEAfEmCY1QWRuGeAE6e Next: BRL1G9DS9DZ8X2RUzwPjJchhgj8SWzug8jg5ip1Vsu12 Diff:
Old | New | Differences | |
---|---|---|---|
44 | 44 | case _ => | |
45 | 45 | throw("Send exactly 0.1 WAVES") | |
46 | 46 | } | |
47 | - | if ( | |
48 | - | then ( | |
49 | - | else | |
50 | - | then | |
51 | - | else | |
47 | + | if ((wavesOrErr != true)) | |
48 | + | then throwErr("Платеж должен быть в WAVES") | |
49 | + | else if ((paymentAmount == amount_due)) | |
50 | + | then throwErr("Неправильная сумма платежа") | |
51 | + | else [ScriptTransfer(i.caller, quantity, assetId)] | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFileName = "p1" | |
5 | 5 | ||
6 | 6 | let SEP = "_" | |
7 | 7 | ||
8 | 8 | let kassetId = "AssetID" | |
9 | 9 | ||
10 | 10 | let knewToken = "Token" | |
11 | 11 | ||
12 | 12 | func keyAssetID () = makeString(["%s", "assetID"], SEP) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func wrapErr (msg) = makeString([contractFileName, ":", msg], "") | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func throwErr (msg) = throw(wrapErr(msg)) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | @Callable(i) | |
22 | 22 | func tokenIssuance () = { | |
23 | 23 | let name = "PRACTICE" | |
24 | 24 | let description = "1:10 waves" | |
25 | 25 | let quantity = 10000000 | |
26 | 26 | let decimals = 3 | |
27 | 27 | let issue_token = Issue(name, description, quantity, decimals, true) | |
28 | 28 | let assetId = calculateAssetId(issue_token) | |
29 | 29 | [issue_token, BinaryEntry(kassetId, assetId), StringEntry(knewToken, issue_token.name)] | |
30 | 30 | } | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | ||
34 | 34 | @Callable(i) | |
35 | 35 | func buyToken (quantity) = { | |
36 | 36 | let wavesOrErr = (i.payments[0].assetId == unit) | |
37 | 37 | let assetId = valueOrErrorMessage(getBinaryValue(this, kassetId), "id токена не найден") | |
38 | 38 | let paymentAmount = i.payments[0].amount | |
39 | 39 | let token_price = 100000 | |
40 | 40 | let amount_due = (token_price * quantity) | |
41 | 41 | let payment = match i.payments[0] { | |
42 | 42 | case p: AttachedPayment => | |
43 | 43 | p | |
44 | 44 | case _ => | |
45 | 45 | throw("Send exactly 0.1 WAVES") | |
46 | 46 | } | |
47 | - | if ( | |
48 | - | then ( | |
49 | - | else | |
50 | - | then | |
51 | - | else | |
47 | + | if ((wavesOrErr != true)) | |
48 | + | then throwErr("Платеж должен быть в WAVES") | |
49 | + | else if ((paymentAmount == amount_due)) | |
50 | + | then throwErr("Неправильная сумма платежа") | |
51 | + | else [ScriptTransfer(i.caller, quantity, assetId)] | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 |
github/deemru/w8io/169f3d6 36.68 ms ◑