tx · 4cYWFiCnPPsCHoMzzpB6QLJjTmLzQHVK4m3rUQujFti3 3NC6GCHE6oxFa8gV9s3w8uoRjJJtHKvwnh4: -0.01000000 Waves 2019.07.18 02:30 [590508] smart account 3NC6GCHE6oxFa8gV9s3w8uoRjJJtHKvwnh4 > SELF 0.00000000 Waves
{ "type": 13, "id": "4cYWFiCnPPsCHoMzzpB6QLJjTmLzQHVK4m3rUQujFti3", "fee": 1000000, "feeAssetId": null, "timestamp": 1563406210007, "version": 1, "sender": "3NC6GCHE6oxFa8gV9s3w8uoRjJJtHKvwnh4", "senderPublicKey": "2tHKMkqZzVcDBFgXDmXysCyQLQhwZQCw5UC2m6sPQoKD", "proofs": [ "4XBnkipcquNuL9zYDbEjSzYjTotPP1Qxv34GKHFstsvuWBfkBP3eoNGmAgQ3a7qX3oRES4bq7JKmnJT9Vq2EPQo3" ], "script": "base64:AAIDAAAAAAAAAAAAAAABAAAAAA5vd25lclB1YmxpY0tleQEAAAAgVOXnI/5W8+oqkj9D2QdcPe1vHp1wzkRu+17NZ6FJb3kAAAACAAAAAWkBAAAAA2JldAAAAAUAAAAGcmFjZUlkAAAAC3BsYXllckluZGV4AAAABkJ0Y0JldAAAAAZFdGhCZXQAAAAJc2lnbmF0dXJlBAAAAAlyYWNlSWRTdHIJAAGkAAAAAQUAAAAGcmFjZUlkBAAAAAdwYXltZW50CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQEAAAACGJldFByaWNlCAUAAAAHcGF5bWVudAAAAAZhbW91bnQEAAAAEGNhbGxlckFkZHJlc3NTdHIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAPY2hlY2tpbmdEYXRhU3RyCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAJcmFjZUlkU3RyBQAAABBjYWxsZXJBZGRyZXNzU3RyCQABpAAAAAEFAAAAC3BsYXllckluZGV4CQABpAAAAAE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ldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAXZmlyc3RQbGFjZVBsYXllckFkZHJlc3MFAAAAD2ZpcnN0UGxhY2VQcml6ZQUAAAAEdW5pdAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABhzZWNvbmRQbGFjZVBsYXllckFkZHJlc3MFAAAAEHNlY29uZFBsYWNlUHJpemUFAAAABHVuaXQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAXdGhpcmRQbGFjZVBsYXllckFkZHJlc3MFAAAAD3RoaXJkUGxhY2VQcml6ZQUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBAAAAAFpBQAAAAckbWF0Y2gwBgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADm93bmVyUHVibGljS2V5Uoobxg==", "chainId": 84, "height": 590508, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let ownerPublicKey = base58'6iQaHazE9NVAJfAjiMpHifDXMfr1euWcy8fmW6rNcdhr' | |
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func bet (raceId,playerIndex,BtcBet,EthBet,signature) = { | |
8 | + | let raceIdStr = toString(raceId) | |
9 | + | let payment = extract(i.payment) | |
10 | + | let betPrice = payment.amount | |
11 | + | let callerAddressStr = toBase58String(i.caller.bytes) | |
12 | + | let checkingDataStr = (((((raceIdStr + callerAddressStr) + toString(playerIndex)) + toString(betPrice)) + toString(BtcBet)) + toString(EthBet)) | |
13 | + | if (!(sigVerify(toBytes(checkingDataStr), signature, ownerPublicKey))) | |
14 | + | then throw("Cannot verify signature") | |
15 | + | else { | |
16 | + | let playerIndexStr = toString(playerIndex) | |
17 | + | WriteSet([DataEntry((((raceIdStr + "_player_") + playerIndexStr) + "_address"), callerAddressStr), DataEntry((((raceIdStr + "_player_") + playerIndexStr) + "_wavelets_bet"), betPrice), DataEntry((((raceIdStr + "_player_") + playerIndexStr) + "_btc_bet"), BtcBet), DataEntry((((raceIdStr + "_player_") + playerIndexStr) + "_eth_bet"), EthBet)]) | |
18 | + | } | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | @Callable(i) | |
24 | + | func endRace (id,firstPlacePlayerIndex,secondPlacePlayerIndex,thirdPlacePlayerIndex,BtcStartPrice,BtcEndPrice,EthStartPrice,EthEndPrice) = if ((i.callerPublicKey != ownerPublicKey)) | |
25 | + | then throw("Only owner can call endRace") | |
26 | + | else { | |
27 | + | let raceIdStr = toString(id) | |
28 | + | let deltaBTC = (BtcEndPrice - BtcStartPrice) | |
29 | + | let deltaETH = (EthEndPrice - EthStartPrice) | |
30 | + | let totalDeposit = ((((getIntegerValue(this, (raceIdStr + "_player_0_wavelets_bet")) + getIntegerValue(this, (raceIdStr + "_player_1_wavelets_bet"))) + getIntegerValue(this, (raceIdStr + "_player_2_wavelets_bet"))) + getIntegerValue(this, (raceIdStr + "_player_3_wavelets_bet"))) + getIntegerValue(this, (raceIdStr + "_player_4_wavelets_bet"))) | |
31 | + | let firstPlacePlayerAddress = addressFromStringValue(getStringValue(this, (((raceIdStr + "_player_") + toString(firstPlacePlayerIndex)) + "_address"))) | |
32 | + | let secondPlacePlayerAddress = addressFromStringValue(getStringValue(this, (((raceIdStr + "_player_") + toString(secondPlacePlayerIndex)) + "_address"))) | |
33 | + | let thirdPlacePlayerAddress = addressFromStringValue(getStringValue(this, (((raceIdStr + "_player_") + toString(thirdPlacePlayerIndex)) + "_address"))) | |
34 | + | let firstPlacePlayerDeposit = getIntegerValue(this, (((raceIdStr + "_player_") + toString(firstPlacePlayerIndex)) + "_wavelets_bet")) | |
35 | + | let secondPlacePlayerDeposit = getIntegerValue(this, (((raceIdStr + "_player_") + toString(secondPlacePlayerIndex)) + "_wavelets_bet")) | |
36 | + | let thirdPlacePlayerDeposit = getIntegerValue(this, (((raceIdStr + "_player_") + toString(thirdPlacePlayerIndex)) + "_wavelets_bet")) | |
37 | + | let firstPlacePrize = (firstPlacePlayerDeposit * 2) | |
38 | + | let secondPlacePrize = ((secondPlacePlayerDeposit * 3) / 2) | |
39 | + | let thirdPlacePrize = thirdPlacePlayerDeposit | |
40 | + | let commission = (totalDeposit - ((firstPlacePrize + secondPlacePrize) + thirdPlacePrize)) | |
41 | + | if ((0 >= commission)) | |
42 | + | then throw("Commission must be greater than 0") | |
43 | + | else { | |
44 | + | let currentAmount = wavesBalance(addressFromPublicKey(ownerPublicKey)) | |
45 | + | let newAmount = (currentAmount - commission) | |
46 | + | if ((0 > newAmount)) | |
47 | + | then throw("Not enough funds in core account") | |
48 | + | else ScriptResult(WriteSet([DataEntry((raceIdStr + "_first_place_player_index"), firstPlacePlayerIndex), DataEntry((raceIdStr + "_second_place_player_index"), secondPlacePlayerIndex), DataEntry((raceIdStr + "_third_place_player_index"), thirdPlacePlayerIndex), DataEntry((raceIdStr + "_btc_start_price"), BtcStartPrice), DataEntry((raceIdStr + "_btc_start_price"), BtcStartPrice), DataEntry((raceIdStr + "_eth_start_price"), EthStartPrice), DataEntry((raceIdStr + "_eth_end_price"), EthStartPrice)]), TransferSet([ScriptTransfer(firstPlacePlayerAddress, firstPlacePrize, unit), ScriptTransfer(secondPlacePlayerAddress, secondPlacePrize, unit), ScriptTransfer(thirdPlacePlayerAddress, thirdPlacePrize, unit)])) | |
49 | + | } | |
50 | + | } | |
51 | + | ||
52 | + | ||
53 | + | @Verifier(tx) | |
54 | + | func verify () = match tx { | |
55 | + | case i: InvokeScriptTransaction => | |
56 | + | true | |
57 | + | case _ => | |
58 | + | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
59 | + | } | |
60 | + |
github/deemru/w8io/026f985 21.87 ms ◑