tx · 9bigCCvqQ3wgduZboVqMkHyfhrE5xamgS6kP8h82Xy9U 3MtkCfhJSAZ6P2bsBM2DdpurZ7S1vepUvrc: -0.01400000 Waves 2019.09.28 01:30 [695443] smart account 3MtkCfhJSAZ6P2bsBM2DdpurZ7S1vepUvrc > SELF 0.00000000 Waves
{ "type": 13, "id": "9bigCCvqQ3wgduZboVqMkHyfhrE5xamgS6kP8h82Xy9U", "fee": 1400000, "feeAssetId": null, "timestamp": 1569623451701, "version": 1, "sender": "3MtkCfhJSAZ6P2bsBM2DdpurZ7S1vepUvrc", "senderPublicKey": "5M8TjFdQ2hPL23uw5RrCvaES2qU4NpCtn68zqTyiYm2E", "proofs": [ "25Ld2TsYDUQwV98LWZT2Ua3ChAP2VCbz4Qve84qk1Lvo5zf7zBaazGL4iTvQA3hRQbdMDekmQ2SnXVAur9iDHTa7" ], "script": "base64:AAIDAAAAAAAAAAAAAAAGAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAAB3Rva2VuSUQJAAJZAAAAAQIAAAAsNHlzWmVVdnRCclNWZ0o5djNNZmgzYldEMldOUGQ1a1E4MjdwaW9nd3BNeDQAAAAACXByaXplUG9vbAkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTXJxelhmUVdUcmhySjZHQmFtU3dLS0R6MzFnZFhMZ0NhcgAAAAAHcHJvamVjdAkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTjVMeTRia3ZnNXVGamY5QnBlQXNpazhMcTJzZkhZYzJIVQAAAAANcGxheWVyU3RvcmFnZQkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTXhaYVdKbWR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AAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAB3Byb2plY3QFAAAADGhhbGZPZkRvbmF0ZQUAAAAEdW5pdAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABFnYW1lV2FsbGV0QWRkcmVzcwAAAAAAAAAnEAUAAAAHdG9rZW5JRAUAAAADbmlsAAAAADXF/d0=", "chainId": 84, "height": 695443, "spentComplexity": 0 } View: original | compacted Prev: 3GvXautqWaQhJwFp7Gn5zAWeBwhyS3xgfeZPRzr5zaQo Next: 4FRCHa1Wu84fxqw3H2nk5vd8CVTt2zXHP6jf6kKYy4s9 Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let COMMISSION = ((5 * WAVELET) / 1000) | |
7 | 7 | ||
8 | - | let tokenID = " | |
8 | + | let tokenID = fromBase58String("4ysZeUvtBrSVgJ9v3Mfh3bWD2WNPd5kQ827piogwpMx4") | |
9 | 9 | ||
10 | 10 | let prizePool = addressFromStringValue("3MrqzXfQWTrhrJ6GBamSwKKDz31gdXLgCar") | |
11 | 11 | ||
43 | 43 | let paymentSumStr = toString(paymentSum) | |
44 | 44 | let gameWalletStr = getStringValue(playerStorage, (playerID + "_address")) | |
45 | 45 | let gameWalletAddress = addressFromStringValue(gameWalletStr) | |
46 | - | TransferSet([ScriptTransfer(prizePool, halfOfDonate, unit), ScriptTransfer(project, halfOfDonate, unit), ScriptTransfer(gameWalletAddress, 10000, | |
46 | + | TransferSet([ScriptTransfer(prizePool, halfOfDonate, unit), ScriptTransfer(project, halfOfDonate, unit), ScriptTransfer(gameWalletAddress, 10000, tokenID)]) | |
47 | 47 | } | |
48 | 48 | } | |
49 | 49 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let WAVELET = ((100 * 1000) * 1000) | |
5 | 5 | ||
6 | 6 | let COMMISSION = ((5 * WAVELET) / 1000) | |
7 | 7 | ||
8 | - | let tokenID = " | |
8 | + | let tokenID = fromBase58String("4ysZeUvtBrSVgJ9v3Mfh3bWD2WNPd5kQ827piogwpMx4") | |
9 | 9 | ||
10 | 10 | let prizePool = addressFromStringValue("3MrqzXfQWTrhrJ6GBamSwKKDz31gdXLgCar") | |
11 | 11 | ||
12 | 12 | let project = addressFromStringValue("3N5Ly4bkvg5uFjf9BpeAsik8Lq2sfHYc2HU") | |
13 | 13 | ||
14 | 14 | let playerStorage = addressFromStringValue("3MxZaWJmdypjv8MMv8RPTtDq4GNMPdCisJP") | |
15 | 15 | ||
16 | 16 | @Callable(i) | |
17 | 17 | func buy (playerID,packageName) = { | |
18 | 18 | let txId = toBase58String(i.transactionId) | |
19 | 19 | let pmt = extract(i.payment) | |
20 | 20 | let paymentAmt = pmt.amount | |
21 | 21 | let halfOfDonate = ((paymentAmt - COMMISSION) / 2) | |
22 | 22 | let paymentSum = ((paymentAmt - COMMISSION) / WAVELET) | |
23 | 23 | let isExistPackage = isDefined(getStringValue(this, packageName)) | |
24 | 24 | if (!(isExistPackage)) | |
25 | 25 | then throw("This package doesn't exist anymore") | |
26 | 26 | else { | |
27 | 27 | let packageNameData = split(packageName, "_") | |
28 | 28 | let tokensAmount = parseIntValue(packageNameData[0]) | |
29 | 29 | let actualPrice = parseIntValue(getStringValue(this, packageName)) | |
30 | 30 | if ((paymentSum != actualPrice)) | |
31 | 31 | then throw(((("Donation amount should be " + toString(actualPrice)) + " Waves, but we got ") + toString(paymentSum))) | |
32 | 32 | else { | |
33 | 33 | let betNotInWaves = isDefined(pmt.assetId) | |
34 | 34 | let feeNotInWaves = isDefined(pmt.assetId) | |
35 | 35 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
36 | 36 | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
37 | 37 | if (betNotInWaves) | |
38 | 38 | then throw("Bet amount must be in Waves") | |
39 | 39 | else if (feeNotInWaves) | |
40 | 40 | then throw("Transaction's fee must be in Waves") | |
41 | 41 | else { | |
42 | 42 | let playerAddressStr = toString(playerAddress) | |
43 | 43 | let paymentSumStr = toString(paymentSum) | |
44 | 44 | let gameWalletStr = getStringValue(playerStorage, (playerID + "_address")) | |
45 | 45 | let gameWalletAddress = addressFromStringValue(gameWalletStr) | |
46 | - | TransferSet([ScriptTransfer(prizePool, halfOfDonate, unit), ScriptTransfer(project, halfOfDonate, unit), ScriptTransfer(gameWalletAddress, 10000, | |
46 | + | TransferSet([ScriptTransfer(prizePool, halfOfDonate, unit), ScriptTransfer(project, halfOfDonate, unit), ScriptTransfer(gameWalletAddress, 10000, tokenID)]) | |
47 | 47 | } | |
48 | 48 | } | |
49 | 49 | } | |
50 | 50 | } | |
51 | 51 | ||
52 | 52 |
github/deemru/w8io/169f3d6 37.55 ms ◑