tx · GXzEJzvSn5CAgf1kQJWLYVrj1dwSmTinSgKUmKjeDJoH 3MtkCfhJSAZ6P2bsBM2DdpurZ7S1vepUvrc: -0.01000000 Waves 2019.09.27 17:47 [694955] smart account 3MtkCfhJSAZ6P2bsBM2DdpurZ7S1vepUvrc > SELF 0.00000000 Waves
{ "type": 13, "id": "GXzEJzvSn5CAgf1kQJWLYVrj1dwSmTinSgKUmKjeDJoH", "fee": 1000000, "feeAssetId": null, "timestamp": 1569595576777, "version": 1, "sender": "3MtkCfhJSAZ6P2bsBM2DdpurZ7S1vepUvrc", "senderPublicKey": "5M8TjFdQ2hPL23uw5RrCvaES2qU4NpCtn68zqTyiYm2E", "proofs": [ "5Rei5mYdGvysiWiPH7dV7BK9LVoRg4rwJeb3UuP6NQuJfwakaNQbDCyrncZp5VvPDvuCUc1GhzubANtKPsQ2yEP4" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAAB3Rva2VuSUQCAAAALDR5c1plVXZ0QnJTVmdKOXYzTWZoM2JXRDJXTlBkNWtRODI3cGlvZ3dwTXg0AAAAAA1wbGF5ZXJTdG9yYWdlAgAAACMzTXhaYVdKbWR5cGp2OE1NdjhSUFR0RHE0R05NUGRDaXNKUAAAAAEAAAABaQEAAAADYnV5AAAAAgAAAAhwbGF5ZXJJRAAAAAtwYWNrYWdlTmFtZQQAAAAEdHhJZAkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAKcGF5bWVudEFtdAgFAAAAA3BtdAAAAAZhbW91bnQEAAAACnBheW1lbnRTdW0JAABpAAAAAgkA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tm90SW5XYXZlcwkAAAIAAAABAgAAABtCZXQgYW1vdW50IG11c3QgYmUgaW4gV2F2ZXMDBQAAAA1mZWVOb3RJbldhdmVzCQAAAgAAAAECAAAAIlRyYW5zYWN0aW9uJ3MgZmVlIG11c3QgYmUgaW4gV2F2ZXMEAAAAEHBsYXllckFkZHJlc3NTdHIJAAQlAAAAAQUAAAANcGxheWVyQWRkcmVzcwQAAAANcGF5bWVudFN1bVN0cgkAAaQAAAABBQAAAApwYXltZW50U3VtBAAAAA1nYW1lV2FsbGV0U3RyAgAAACMzTXZQd3ZNUVBjU0V1R01vQ0pvNlg5emk4cnI0YUVpV1dwRgQAAAARZ2FtZVdhbGxldEFkZHJlc3MJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAANZ2FtZVdhbGxldFN0cgQAAAAOdG9rZW5zVHJhbnNmZXIJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAARZ2FtZVdhbGxldEFkZHJlc3MFAAAADHRva2Vuc0Ftb3VudAkAAZsAAAABBQAAAAd0b2tlbklEBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAADnRva2Vuc1RyYW5zZmVyAAAAAGVIA80=", "chainId": 84, "height": 694955, "spentComplexity": 0 } View: original | compacted Prev: none Next: 8shKPk51a3hSL8gFEWf2hYdUxZmxYr3L5ma7joBq4Ea3 Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let WAVELET = ((100 * 1000) * 1000) | |
5 | + | ||
6 | + | let COMMISSION = ((5 * WAVELET) / 1000) | |
7 | + | ||
8 | + | let tokenID = "4ysZeUvtBrSVgJ9v3Mfh3bWD2WNPd5kQ827piogwpMx4" | |
9 | + | ||
10 | + | let playerStorage = "3MxZaWJmdypjv8MMv8RPTtDq4GNMPdCisJP" | |
11 | + | ||
12 | + | @Callable(i) | |
13 | + | func buy (playerID,packageName) = { | |
14 | + | let txId = toBase58String(i.transactionId) | |
15 | + | let pmt = extract(i.payment) | |
16 | + | let paymentAmt = pmt.amount | |
17 | + | let paymentSum = ((paymentAmt - COMMISSION) / 1000000) | |
18 | + | let isExistPackage = isDefined(getStringValue(this, packageName)) | |
19 | + | if (!(isExistPackage)) | |
20 | + | then throw("This package doesn't exist anymore") | |
21 | + | else { | |
22 | + | let packageNameData = split(packageName, "_") | |
23 | + | let tokensAmount = parseIntValue(packageNameData[0]) | |
24 | + | let actualPrice = parseIntValue(getStringValue(this, packageName)) | |
25 | + | if ((paymentSum != actualPrice)) | |
26 | + | then throw((("Donation amount should be " + toString(actualPrice)) + " Waves")) | |
27 | + | else { | |
28 | + | let betNotInWaves = isDefined(pmt.assetId) | |
29 | + | let feeNotInWaves = isDefined(pmt.assetId) | |
30 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
31 | + | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
32 | + | if (betNotInWaves) | |
33 | + | then throw("Bet amount must be in Waves") | |
34 | + | else if (feeNotInWaves) | |
35 | + | then throw("Transaction's fee must be in Waves") | |
36 | + | else { | |
37 | + | let playerAddressStr = toString(playerAddress) | |
38 | + | let paymentSumStr = toString(paymentSum) | |
39 | + | let gameWalletStr = "3MvPwvMQPcSEuGMoCJo6X9zi8rr4aEiWWpF" | |
40 | + | let gameWalletAddress = addressFromStringValue(gameWalletStr) | |
41 | + | let tokensTransfer = [ScriptTransfer(gameWalletAddress, tokensAmount, toBytes(tokenID))] | |
42 | + | TransferSet(tokensTransfer) | |
43 | + | } | |
44 | + | } | |
45 | + | } | |
46 | + | } | |
47 | + | ||
48 | + |
github/deemru/w8io/026f985 29.18 ms ◑