tx · 8f9EiU3CsEPaQpqZvBiHEmqjUX3PBmjrFpA8svk5iEjk 3MtkCfhJSAZ6P2bsBM2DdpurZ7S1vepUvrc: -0.01400000 Waves 2019.09.28 13:05 [696145] smart account 3MtkCfhJSAZ6P2bsBM2DdpurZ7S1vepUvrc > SELF 0.00000000 Waves
{ "type": 13, "id": "8f9EiU3CsEPaQpqZvBiHEmqjUX3PBmjrFpA8svk5iEjk", "fee": 1400000, "feeAssetId": null, "timestamp": 1569665188085, "version": 1, "sender": "3MtkCfhJSAZ6P2bsBM2DdpurZ7S1vepUvrc", "senderPublicKey": "5M8TjFdQ2hPL23uw5RrCvaES2qU4NpCtn68zqTyiYm2E", "proofs": [ "5eBnJyCvotrRQMKsLFpE9mvsgZsjPYZBceWen8EVZa2iGxs8u4ymYLtHrMiuBMYebde7MfKTqeriDYzkhW4guZwR" ], "script": "base64:AAIDAAAAAAAAAAAAAAAGAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAAB3Rva2VuSUQJAAJZAAAAAQIAAAAsNHlzWmVVdnRCclNWZ0o5djNNZmgzYldEMldOUGQ1a1E4MjdwaW9nd3BNeDQAAAAACXByaXplUG9vbAkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTXJxelhmUVdUcmhySjZHQmFtU3dLS0R6MzFnZFhMZ0NhcgAAAAAHcHJvamVjdAkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTjVMeTRia3ZnNXVGamY5QnBlQXNpazhMcTJzZkhZYzJIVQAAAAANcGxheWVyU3RvcmFnZQkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTXhaYVdKbWR5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AAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAJcHJpemVQb29sBQAAAAxoYWxmT2ZEb25hdGUFAAAABHVuaXQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAHcHJvamVjdAUAAAAMaGFsZk9mRG9uYXRlBQAAAAR1bml0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAEWdhbWVXYWxsZXRBZGRyZXNzBQAAAAx0b2tlbnNBbW91bnQFAAAAB3Rva2VuSUQFAAAAA25pbAAAAACrWVIe", "chainId": 84, "height": 696145, "spentComplexity": 0 } View: original | compacted Prev: Bznk7Lj9u5D2Ek5kA9v59dBmMWA7aDRSqvzQ2jeoymgH Next: none Diff:
Old | New | Differences | |
---|---|---|---|
20 | 20 | let paymentAmt = pmt.amount | |
21 | 21 | let halfOfDonate = ((paymentAmt - COMMISSION) / 2) | |
22 | 22 | let paymentSum = ((paymentAmt - COMMISSION) / WAVELET) | |
23 | + | let isExistPackage = isDefined(getStringValue(this, packageName)) | |
23 | 24 | if ((1 == 1)) | |
24 | - | then throw(toString(paymentSum)) | |
25 | - | else { | |
26 | - | let isExistPackage = isDefined(getStringValue(this, packageName)) | |
27 | - | if (!(isExistPackage)) | |
28 | - | then throw("This package doesn't exist anymore") | |
29 | - | else { | |
30 | - | let packageNameData = split(packageName, "_") | |
31 | - | let tokensAmount = parseIntValue(packageNameData[0]) | |
32 | - | let actualPrice = parseIntValue(getStringValue(this, packageName)) | |
33 | - | if ((paymentSum != actualPrice)) | |
34 | - | then throw(((("Donation amount should be " + toString(actualPrice)) + " Waves, but we got ") + toString(paymentSum))) | |
35 | - | else { | |
36 | - | let betNotInWaves = isDefined(pmt.assetId) | |
37 | - | let feeNotInWaves = isDefined(pmt.assetId) | |
38 | - | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
39 | - | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
40 | - | if (betNotInWaves) | |
41 | - | then throw("Bet amount must be in Waves") | |
42 | - | else if (feeNotInWaves) | |
43 | - | then throw("Transaction's fee must be in Waves") | |
44 | - | else { | |
45 | - | let playerAddressStr = toString(playerAddress) | |
46 | - | let paymentSumStr = toString(paymentSum) | |
47 | - | let gameWalletStr = getStringValue(playerStorage, (playerID + "_address")) | |
48 | - | let gameWalletAddress = addressFromStringValue(gameWalletStr) | |
49 | - | TransferSet([ScriptTransfer(prizePool, halfOfDonate, unit), ScriptTransfer(project, halfOfDonate, unit), ScriptTransfer(gameWalletAddress, tokensAmount, tokenID)]) | |
50 | - | } | |
51 | - | } | |
52 | - | } | |
53 | - | } | |
25 | + | then throw(toString(isExistPackage)) | |
26 | + | else if (!(isExistPackage)) | |
27 | + | then throw("This package doesn't exist anymore") | |
28 | + | else { | |
29 | + | let packageNameData = split(packageName, "_") | |
30 | + | let tokensAmount = parseIntValue(packageNameData[0]) | |
31 | + | let actualPrice = parseIntValue(getStringValue(this, packageName)) | |
32 | + | if ((paymentSum != actualPrice)) | |
33 | + | then throw(((("Donation amount should be " + toString(actualPrice)) + " Waves, but we got ") + toString(paymentSum))) | |
34 | + | else { | |
35 | + | let betNotInWaves = isDefined(pmt.assetId) | |
36 | + | let feeNotInWaves = isDefined(pmt.assetId) | |
37 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
38 | + | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
39 | + | if (betNotInWaves) | |
40 | + | then throw("Bet amount must be in Waves") | |
41 | + | else if (feeNotInWaves) | |
42 | + | then throw("Transaction's fee must be in Waves") | |
43 | + | else { | |
44 | + | let playerAddressStr = toString(playerAddress) | |
45 | + | let paymentSumStr = toString(paymentSum) | |
46 | + | let gameWalletStr = getStringValue(playerStorage, (playerID + "_address")) | |
47 | + | let gameWalletAddress = addressFromStringValue(gameWalletStr) | |
48 | + | TransferSet([ScriptTransfer(prizePool, halfOfDonate, unit), ScriptTransfer(project, halfOfDonate, unit), ScriptTransfer(gameWalletAddress, tokensAmount, tokenID)]) | |
49 | + | } | |
50 | + | } | |
51 | + | } | |
54 | 52 | } | |
55 | 53 | ||
56 | 54 |
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 | 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 | + | let isExistPackage = isDefined(getStringValue(this, packageName)) | |
23 | 24 | if ((1 == 1)) | |
24 | - | then throw(toString(paymentSum)) | |
25 | - | else { | |
26 | - | let isExistPackage = isDefined(getStringValue(this, packageName)) | |
27 | - | if (!(isExistPackage)) | |
28 | - | then throw("This package doesn't exist anymore") | |
29 | - | else { | |
30 | - | let packageNameData = split(packageName, "_") | |
31 | - | let tokensAmount = parseIntValue(packageNameData[0]) | |
32 | - | let actualPrice = parseIntValue(getStringValue(this, packageName)) | |
33 | - | if ((paymentSum != actualPrice)) | |
34 | - | then throw(((("Donation amount should be " + toString(actualPrice)) + " Waves, but we got ") + toString(paymentSum))) | |
35 | - | else { | |
36 | - | let betNotInWaves = isDefined(pmt.assetId) | |
37 | - | let feeNotInWaves = isDefined(pmt.assetId) | |
38 | - | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
39 | - | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
40 | - | if (betNotInWaves) | |
41 | - | then throw("Bet amount must be in Waves") | |
42 | - | else if (feeNotInWaves) | |
43 | - | then throw("Transaction's fee must be in Waves") | |
44 | - | else { | |
45 | - | let playerAddressStr = toString(playerAddress) | |
46 | - | let paymentSumStr = toString(paymentSum) | |
47 | - | let gameWalletStr = getStringValue(playerStorage, (playerID + "_address")) | |
48 | - | let gameWalletAddress = addressFromStringValue(gameWalletStr) | |
49 | - | TransferSet([ScriptTransfer(prizePool, halfOfDonate, unit), ScriptTransfer(project, halfOfDonate, unit), ScriptTransfer(gameWalletAddress, tokensAmount, tokenID)]) | |
50 | - | } | |
51 | - | } | |
52 | - | } | |
53 | - | } | |
25 | + | then throw(toString(isExistPackage)) | |
26 | + | else if (!(isExistPackage)) | |
27 | + | then throw("This package doesn't exist anymore") | |
28 | + | else { | |
29 | + | let packageNameData = split(packageName, "_") | |
30 | + | let tokensAmount = parseIntValue(packageNameData[0]) | |
31 | + | let actualPrice = parseIntValue(getStringValue(this, packageName)) | |
32 | + | if ((paymentSum != actualPrice)) | |
33 | + | then throw(((("Donation amount should be " + toString(actualPrice)) + " Waves, but we got ") + toString(paymentSum))) | |
34 | + | else { | |
35 | + | let betNotInWaves = isDefined(pmt.assetId) | |
36 | + | let feeNotInWaves = isDefined(pmt.assetId) | |
37 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
38 | + | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
39 | + | if (betNotInWaves) | |
40 | + | then throw("Bet amount must be in Waves") | |
41 | + | else if (feeNotInWaves) | |
42 | + | then throw("Transaction's fee must be in Waves") | |
43 | + | else { | |
44 | + | let playerAddressStr = toString(playerAddress) | |
45 | + | let paymentSumStr = toString(paymentSum) | |
46 | + | let gameWalletStr = getStringValue(playerStorage, (playerID + "_address")) | |
47 | + | let gameWalletAddress = addressFromStringValue(gameWalletStr) | |
48 | + | TransferSet([ScriptTransfer(prizePool, halfOfDonate, unit), ScriptTransfer(project, halfOfDonate, unit), ScriptTransfer(gameWalletAddress, tokensAmount, tokenID)]) | |
49 | + | } | |
50 | + | } | |
51 | + | } | |
54 | 52 | } | |
55 | 53 | ||
56 | 54 |
github/deemru/w8io/026f985 23.97 ms ◑