tx · BFRVnotfL65bmDNVHTBygYpQyBwyMUxTnuzJQNhwVyvJ
3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD: -0.01000000 Waves
2023.07.27 18:48 [2684465] smart account 3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD > SELF 0.00000000 Waves
{
"type": 13,
"id": "BFRVnotfL65bmDNVHTBygYpQyBwyMUxTnuzJQNhwVyvJ",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1690472922788,
"version": 2,
"chainId": 84,
"sender": "3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD",
"senderPublicKey": "G6PnkMn8MpXBkNwsQKMn1o1V7EKMgZyHCJRdFMQuouBC",
"proofs": [
"4wXcpzGxgLdyaSVPk52NbrPHXNYvGBuJoyFsfmrssd9iBzxXYNb7VnbH8x51KoPd4d3SR2agHGMsZ5d2CipwPjAg"
],
"script": "base64:BgIJCAISABIDCgEBBgAQY29udHJhY3RGaWxlTmFtZQICcDEAA1NFUAIBXwAIa2Fzc2V0SWQCB0Fzc2V0SUQACWtuZXdUb2tlbgIFVG9rZW4BB3dyYXBFcnIBA21zZwkAuQkCCQDMCAIFEGNvbnRyYWN0RmlsZU5hbWUJAMwIAgIBOgkAzAgCBQNtc2cFA25pbAIAAQh0aHJvd0VycgEDbXNnCQACAQkBB3dyYXBFcnIBBQNtc2cCAWkBDXRva2VuSXNzdWFuY2UABARuYW1lAghQUkFDVElDRQQLZGVzY3JpcHRpb24CCjE6MTAgd2F2ZXMECHF1YW50aXR5AICt4gQECGRlY2ltYWxzAAMEC2lzc3VlX3Rva2VuCQDCCAUFBG5hbWUFC2Rlc2NyaXB0aW9uBQhxdWFudGl0eQUIZGVjaW1hbHMGBAdhc3NldElkCQC4CAEFC2lzc3VlX3Rva2VuCQDMCAIFC2lzc3VlX3Rva2VuCQDMCAIJAQtCaW5hcnlFbnRyeQIFCGthc3NldElkBQdhc3NldElkCQDMCAIJAQtTdHJpbmdFbnRyeQIFCWtuZXdUb2tlbggFC2lzc3VlX3Rva2VuBG5hbWUFA25pbAFpAQlidXlzVG9rZW4BCHF1YW50aXR5BAp3YXZlc09yRXJyCQAAAggJAJEDAggFAWkIcGF5bWVudHMAAAdhc3NldElkBQR1bml0BAdhc3NldElkCQETdmFsdWVPckVycm9yTWVzc2FnZQIJARFAZXh0ck5hdGl2ZSgxMDUyKQIFBHRoaXMFCGthc3NldElkAiFpZCDRgtC+0LrQtdC90LAg0L3QtSDQvdCw0LnQtNC10L0EDXBheW1lbnRBbW91bnQICQCRAwIIBQFpCHBheW1lbnRzAAAGYW1vdW50BAt0b2tlbl9wcmljZQkAaQIAAQCAwtcvBBF0b2tlbnNfdG9fcmVjZWl2ZQkAaQIFDXBheW1lbnRBbW91bnQJAGgCBQt0b2tlbl9wcmljZQUIcXVhbnRpdHkDCQAAAgUKd2F2ZXNPckVycgYJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwgFAWkGY2FsbGVyBRF0b2tlbnNfdG9fcmVjZWl2ZQUHYXNzZXRJZAUDbmlsCQEIdGhyb3dFcnIBAivQn9C70LDRgtC10LYg0LTQvtC70LbQtdC9INCx0YvRgtGMINCyIFdBVkVTAHapglA=",
"height": 2684465,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 9uWvjSoKwswtLwBfTHbKtfUTgp8epS9AJKSqdCpbDjoU
Next: 3LMztjcGwuaKG9tsAto1gY9v7tb3PDB2QSMs3YqPYrjP
Diff:
Old | New | | Differences |
---|
29 | 29 | | |
---|
30 | 30 | | |
---|
31 | 31 | | @Callable(i) |
---|
32 | | - | func buyToken (quantity) = { |
---|
33 | | - | let wavesOrErr = (i.payments[0].assetId == unit) |
---|
34 | | - | let assetId = valueOrErrorMessage(getBinaryValue(this, kassetId), "id токена не найден") |
---|
35 | | - | let paymentAmount = i.payments[0].amount |
---|
36 | | - | let token_price = 10000000 |
---|
37 | | - | let tokens_to_receive = (paymentAmount / (token_price * quantity)) |
---|
38 | | - | [ScriptTransfer(i.caller, tokens_to_receive, assetId)] |
---|
39 | | - | } |
---|
40 | | - | |
---|
41 | | - | |
---|
42 | | - | |
---|
43 | | - | @Callable(i) |
---|
44 | 32 | | func buysToken (quantity) = { |
---|
45 | 33 | | let wavesOrErr = (i.payments[0].assetId == unit) |
---|
46 | 34 | | let assetId = valueOrErrorMessage(getBinaryValue(this, kassetId), "id токена не найден") |
---|
47 | 35 | | let paymentAmount = i.payments[0].amount |
---|
48 | | - | let token_price = 10000000 |
---|
49 | | - | let tokens_to_receive = (paymentAmount * (token_price * quantity)) |
---|
| 36 | + | let token_price = (1 / 100000000) |
---|
| 37 | + | let tokens_to_receive = (paymentAmount / (token_price * quantity)) |
---|
50 | 38 | | if ((wavesOrErr == true)) |
---|
51 | 39 | | then [ScriptTransfer(i.caller, tokens_to_receive, assetId)] |
---|
52 | 40 | | else throwErr("Платеж должен быть в WAVES") |
---|
Full:
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 wrapErr (msg) = makeString([contractFileName, ":", msg], "") |
---|
13 | 13 | | |
---|
14 | 14 | | |
---|
15 | 15 | | func throwErr (msg) = throw(wrapErr(msg)) |
---|
16 | 16 | | |
---|
17 | 17 | | |
---|
18 | 18 | | @Callable(i) |
---|
19 | 19 | | func tokenIssuance () = { |
---|
20 | 20 | | let name = "PRACTICE" |
---|
21 | 21 | | let description = "1:10 waves" |
---|
22 | 22 | | let quantity = 10000000 |
---|
23 | 23 | | let decimals = 3 |
---|
24 | 24 | | let issue_token = Issue(name, description, quantity, decimals, true) |
---|
25 | 25 | | let assetId = calculateAssetId(issue_token) |
---|
26 | 26 | | [issue_token, BinaryEntry(kassetId, assetId), StringEntry(knewToken, issue_token.name)] |
---|
27 | 27 | | } |
---|
28 | 28 | | |
---|
29 | 29 | | |
---|
30 | 30 | | |
---|
31 | 31 | | @Callable(i) |
---|
32 | | - | func buyToken (quantity) = { |
---|
33 | | - | let wavesOrErr = (i.payments[0].assetId == unit) |
---|
34 | | - | let assetId = valueOrErrorMessage(getBinaryValue(this, kassetId), "id токена не найден") |
---|
35 | | - | let paymentAmount = i.payments[0].amount |
---|
36 | | - | let token_price = 10000000 |
---|
37 | | - | let tokens_to_receive = (paymentAmount / (token_price * quantity)) |
---|
38 | | - | [ScriptTransfer(i.caller, tokens_to_receive, assetId)] |
---|
39 | | - | } |
---|
40 | | - | |
---|
41 | | - | |
---|
42 | | - | |
---|
43 | | - | @Callable(i) |
---|
44 | 32 | | func buysToken (quantity) = { |
---|
45 | 33 | | let wavesOrErr = (i.payments[0].assetId == unit) |
---|
46 | 34 | | let assetId = valueOrErrorMessage(getBinaryValue(this, kassetId), "id токена не найден") |
---|
47 | 35 | | let paymentAmount = i.payments[0].amount |
---|
48 | | - | let token_price = 10000000 |
---|
49 | | - | let tokens_to_receive = (paymentAmount * (token_price * quantity)) |
---|
| 36 | + | let token_price = (1 / 100000000) |
---|
| 37 | + | let tokens_to_receive = (paymentAmount / (token_price * quantity)) |
---|
50 | 38 | | if ((wavesOrErr == true)) |
---|
51 | 39 | | then [ScriptTransfer(i.caller, tokens_to_receive, assetId)] |
---|
52 | 40 | | else throwErr("Платеж должен быть в WAVES") |
---|
53 | 41 | | } |
---|
54 | 42 | | |
---|
55 | 43 | | |
---|