tx · 8GVeXGySAr7bQgBWCAgH3br2n7WFjwEwo54sr2FTxUky

3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD:  -0.01000000 Waves

2023.07.30 11:27 [2688361] smart account 3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD > SELF 0.00000000 Waves

{ "type": 13, "id": "8GVeXGySAr7bQgBWCAgH3br2n7WFjwEwo54sr2FTxUky", "fee": 1000000, "feeAssetId": null, "timestamp": 1690705686328, "version": 2, "chainId": 84, "sender": "3MwPF8FWd4fYohy6CXXB6wtjbRRvqFpxmdD", "senderPublicKey": "G6PnkMn8MpXBkNwsQKMn1o1V7EKMgZyHCJRdFMQuouBC", "proofs": [ "3UJagm34g1VwKqEj8HgRRBv9YpNRdymAWZkFLCbQVfoK9jjWstiD5usCFUBhcpRMyZ9H3t83TpjnpRBpHDADN1ZT" ], "script": "base64:BgIJCAISABIDCgEBBwAQY29udHJhY3RGaWxlTmFtZQICcDEAA1NFUAIBXwAIa2Fzc2V0SWQCB0Fzc2V0SUQACWtuZXdUb2tlbgIFVG9rZW4BCmtleUFzc2V0SUQACQC5CQIJAMwIAgICJXMJAMwIAgIHYXNzZXRJRAUDbmlsBQNTRVABB3dyYXBFcnIBA21zZwkAuQkCCQDMCAIFEGNvbnRyYWN0RmlsZU5hbWUJAMwIAgIBOgkAzAgCBQNtc2cFA25pbAIAAQh0aHJvd0VycgEDbXNnCQACAQkBB3dyYXBFcnIBBQNtc2cCAWkBDXRva2VuSXNzdWFuY2UABARuYW1lAghQUkFDVElDRQQLZGVzY3JpcHRpb24CCjE6MTAgd2F2ZXMECHF1YW50aXR5AICt4gQECGRlY2ltYWxzAAMEC2lzc3VlX3Rva2VuCQDCCAUFBG5hbWUFC2Rlc2NyaXB0aW9uBQhxdWFudGl0eQUIZGVjaW1hbHMGBAdhc3NldElkCQC4CAEFC2lzc3VlX3Rva2VuCQDMCAIFC2lzc3VlX3Rva2VuCQDMCAIJAQtCaW5hcnlFbnRyeQIFCGthc3NldElkBQdhc3NldElkCQDMCAIJAQtTdHJpbmdFbnRyeQIFCWtuZXdUb2tlbggFC2lzc3VlX3Rva2VuBG5hbWUFA25pbAFpAQhidXlUb2tlbgEIcXVhbnRpdHkECndhdmVzT3JFcnIJAAACCAkAkQMCCAUBaQhwYXltZW50cwAAB2Fzc2V0SWQFBHVuaXQEB2Fzc2V0SWQJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkBEUBleHRyTmF0aXZlKDEwNTIpAgUEdGhpcwUIa2Fzc2V0SWQCIWlkINGC0L7QutC10L3QsCDQvdC1INC90LDQudC00LXQvQQNcGF5bWVudEFtb3VudAgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQEC3Rva2VuX3ByaWNlAKCNBgQKYW1vdW50X2R1ZQkAaAIFC3Rva2VuX3ByaWNlBQhxdWFudGl0eQQHcGF5bWVudAQHJG1hdGNoMAkAkQMCCAUBaQhwYXltZW50cwAAAwkAAQIFByRtYXRjaDACD0F0dGFjaGVkUGF5bWVudAQBcAUHJG1hdGNoMAUBcAkAAgECFlNlbmQgZXhhY3RseSAwLjEgV0FWRVMDCQAAAgUKd2F2ZXNPckVycgYJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwgFAWkGY2FsbGVyBQhxdWFudGl0eQUHYXNzZXRJZAUDbmlsCQEIdGhyb3dFcnIBAivQn9C70LDRgtC10LYg0LTQvtC70LbQtdC9INCx0YvRgtGMINCyIFdBVkVTAP1cpds=", "height": 2688361, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FmLU4XSN479srnTbPzuq5GkeLeW1Jif1Y8BXvvHMrrFG Next: 73KbMpTwPmqMtA1Z1pz7tZjeQsEAfEmCY1QWRuGeAE6e Diff:
OldNewDifferences
88 let kassetId = "AssetID"
99
1010 let knewToken = "Token"
11+
12+func keyAssetID () = makeString(["%s", "assetID"], SEP)
13+
1114
1215 func wrapErr (msg) = makeString([contractFileName, ":", msg], "")
1316
2932
3033
3134 @Callable(i)
32-func buysToken (quantity) = {
35+func buyToken (quantity) = {
3336 let wavesOrErr = (i.payments[0].assetId == unit)
3437 let assetId = valueOrErrorMessage(getBinaryValue(this, kassetId), "id токена не найден")
3538 let paymentAmount = i.payments[0].amount
36- let token_price = (1 / 10000000)
39+ let token_price = 100000
3740 let amount_due = (token_price * quantity)
38- if (if ((wavesOrErr == true))
39- then (paymentAmount == amount_due)
40- else false)
41+ let payment = match i.payments[0] {
42+ case p: AttachedPayment =>
43+ p
44+ case _ =>
45+ throw("Send exactly 0.1 WAVES")
46+ }
47+ if ((wavesOrErr == true))
4148 then [ScriptTransfer(i.caller, quantity, assetId)]
4249 else throwErr("Платеж должен быть в WAVES")
4350 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let contractFileName = "p1"
55
66 let SEP = "_"
77
88 let kassetId = "AssetID"
99
1010 let knewToken = "Token"
11+
12+func keyAssetID () = makeString(["%s", "assetID"], SEP)
13+
1114
1215 func wrapErr (msg) = makeString([contractFileName, ":", msg], "")
1316
1417
1518 func throwErr (msg) = throw(wrapErr(msg))
1619
1720
1821 @Callable(i)
1922 func tokenIssuance () = {
2023 let name = "PRACTICE"
2124 let description = "1:10 waves"
2225 let quantity = 10000000
2326 let decimals = 3
2427 let issue_token = Issue(name, description, quantity, decimals, true)
2528 let assetId = calculateAssetId(issue_token)
2629 [issue_token, BinaryEntry(kassetId, assetId), StringEntry(knewToken, issue_token.name)]
2730 }
2831
2932
3033
3134 @Callable(i)
32-func buysToken (quantity) = {
35+func buyToken (quantity) = {
3336 let wavesOrErr = (i.payments[0].assetId == unit)
3437 let assetId = valueOrErrorMessage(getBinaryValue(this, kassetId), "id токена не найден")
3538 let paymentAmount = i.payments[0].amount
36- let token_price = (1 / 10000000)
39+ let token_price = 100000
3740 let amount_due = (token_price * quantity)
38- if (if ((wavesOrErr == true))
39- then (paymentAmount == amount_due)
40- else false)
41+ let payment = match i.payments[0] {
42+ case p: AttachedPayment =>
43+ p
44+ case _ =>
45+ throw("Send exactly 0.1 WAVES")
46+ }
47+ if ((wavesOrErr == true))
4148 then [ScriptTransfer(i.caller, quantity, assetId)]
4249 else throwErr("Платеж должен быть в WAVES")
4350 }
4451
4552

github/deemru/w8io/169f3d6 
31.30 ms