tx · F2QYekQkKhncyXz8SKqjfGa6SvG7NhV4S3QHGDh3e4aG 3N7eEzkCtBoWaNRe4ZuTPrChbnjBLKDb9Bx: -0.01000000 Waves 2023.05.20 14:51 [2586264] smart account 3N7eEzkCtBoWaNRe4ZuTPrChbnjBLKDb9Bx > SELF 0.00000000 Waves
{ "type": 13, "id": "F2QYekQkKhncyXz8SKqjfGa6SvG7NhV4S3QHGDh3e4aG", "fee": 1000000, "feeAssetId": null, "timestamp": 1684583504487, "version": 2, "chainId": 84, "sender": "3N7eEzkCtBoWaNRe4ZuTPrChbnjBLKDb9Bx", "senderPublicKey": "2NK7BrUZMvnHzAoHnJfz3FuDBP5zYUNoxshB49AH2kbc", "proofs": [ "42K68cgCP9rg3cCgVq8mYFWwmwqpx1wJRhVDG3ZikkYsfSxFf34LQs79fmkpZFcnbny9cMHjf63zeC4S7ppnH6bt" ], "script": "base64:BgIECAISAAABAWkBCHJvdWxldHRlAAQDYmV0CAkAkQMCCAUBaQhwYXltZW50cwAABmFtb3VudAQHYXNzZXRJRAgJAJEDAggFAWkIcGF5bWVudHMAAAdhc3NldElkBAFjAgRSaWRlBAdjVG9CeXRlCQCgAwEJAJ4DAQkA3QQBBQFjBAlyYW5kb21OdW0JAGoCBQdjVG9CeXRlAGQEDndpblByb2JhYmlsaXR5ACgEC3dpblRyYW5zZmVyCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgkAaAIFA2JldAACBQdhc3NldElEBQNuaWwECXdpbkFtb3VudAMJAGYCBQlyYW5kb21OdW0FDndpblByb2JhYmlsaXR5BQt3aW5UcmFuc2ZlcgAABA13cml0ZUxhc3RQbGF5CQDMCAIJAQxJbnRlZ2VyRW50cnkCAghsYXN0UGxheQUJcmFuZG9tTnVtBQNuaWwDCQBmAgUOd2luUHJvYmFiaWxpdHkFCXJhbmRvbU51bQkAlAoCBQt3aW5UcmFuc2ZlcgUNd3JpdGVMYXN0UGxheQkAlAoCCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgAABQdhc3NldElEBQNuaWwFDXdyaXRlTGFzdFBsYXkBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5Mx6k7g==", "height": 2586264, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Uweb62BE8nyR5CdxBREUg6iAFNC7dWLpCDeb7WTubFd Next: BZ4uBfwT1GxUjouTrktfKH4WYWDBf81Pa9MsCRgLNbEN Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func definedLiquidity () = { | |
8 | - | let tokenName = "Liquidity Token" | |
9 | - | let tokenSymbol = "LQT" | |
10 | - | let decimals = 8 | |
11 | - | let initialSupply = 1000000000 | |
12 | - | let $t0336438 = $Tuple2(toBase58String(value(i.payments[0].assetId)), value(i.payments[0].amount)) | |
13 | - | let asset0 = $t0336438._1 | |
14 | - | let amount0 = $t0336438._2 | |
15 | - | let $t0439568 = $Tuple2(toBase58String(value(i.payments[1].assetId)), value(i.payments[1].amount)) | |
16 | - | let asset1 = $t0439568._1 | |
17 | - | let amount1 = $t0439568._2 | |
18 | - | let asset0Balance = assetBalance(this, value(i.payments[0].assetId)) | |
19 | - | let asset1Balance = assetBalance(this, value(i.payments[1].assetId)) | |
20 | - | let totalLiquidity = if (if ((amount0 != 0)) | |
21 | - | then true | |
22 | - | else (amount1 != 0)) | |
23 | - | then (asset0Balance * asset1Balance) | |
24 | - | else throw("liquidity undifined") | |
25 | - | let liquidityAmount = if (if ((amount0 == 0)) | |
26 | - | then true | |
27 | - | else (amount1 == 0)) | |
28 | - | then 0 | |
29 | - | else ((amount0 * amount1) / totalLiquidity) | |
30 | - | let liquidityToken = [Issue(tokenName, tokenSymbol, liquidityAmount, decimals, true)] | |
31 | - | nil | |
7 | + | func roulette () = { | |
8 | + | let bet = i.payments[0].amount | |
9 | + | let assetID = i.payments[0].assetId | |
10 | + | let c = "Ride" | |
11 | + | let cToByte = toInt(toBigInt(fromBase16String(c))) | |
12 | + | let randomNum = (cToByte % 100) | |
13 | + | let winProbability = 40 | |
14 | + | let winTransfer = [ScriptTransfer(i.caller, (bet * 2), assetID)] | |
15 | + | let winAmount = if ((randomNum > winProbability)) | |
16 | + | then winTransfer | |
17 | + | else 0 | |
18 | + | let writeLastPlay = [IntegerEntry("lastPlay", randomNum)] | |
19 | + | if ((winProbability > randomNum)) | |
20 | + | then $Tuple2(winTransfer, writeLastPlay) | |
21 | + | else $Tuple2([ScriptTransfer(i.caller, 0, assetID)], writeLastPlay) | |
32 | 22 | } | |
33 | 23 | ||
34 | 24 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func definedLiquidity () = { | |
8 | - | let tokenName = "Liquidity Token" | |
9 | - | let tokenSymbol = "LQT" | |
10 | - | let decimals = 8 | |
11 | - | let initialSupply = 1000000000 | |
12 | - | let $t0336438 = $Tuple2(toBase58String(value(i.payments[0].assetId)), value(i.payments[0].amount)) | |
13 | - | let asset0 = $t0336438._1 | |
14 | - | let amount0 = $t0336438._2 | |
15 | - | let $t0439568 = $Tuple2(toBase58String(value(i.payments[1].assetId)), value(i.payments[1].amount)) | |
16 | - | let asset1 = $t0439568._1 | |
17 | - | let amount1 = $t0439568._2 | |
18 | - | let asset0Balance = assetBalance(this, value(i.payments[0].assetId)) | |
19 | - | let asset1Balance = assetBalance(this, value(i.payments[1].assetId)) | |
20 | - | let totalLiquidity = if (if ((amount0 != 0)) | |
21 | - | then true | |
22 | - | else (amount1 != 0)) | |
23 | - | then (asset0Balance * asset1Balance) | |
24 | - | else throw("liquidity undifined") | |
25 | - | let liquidityAmount = if (if ((amount0 == 0)) | |
26 | - | then true | |
27 | - | else (amount1 == 0)) | |
28 | - | then 0 | |
29 | - | else ((amount0 * amount1) / totalLiquidity) | |
30 | - | let liquidityToken = [Issue(tokenName, tokenSymbol, liquidityAmount, decimals, true)] | |
31 | - | nil | |
7 | + | func roulette () = { | |
8 | + | let bet = i.payments[0].amount | |
9 | + | let assetID = i.payments[0].assetId | |
10 | + | let c = "Ride" | |
11 | + | let cToByte = toInt(toBigInt(fromBase16String(c))) | |
12 | + | let randomNum = (cToByte % 100) | |
13 | + | let winProbability = 40 | |
14 | + | let winTransfer = [ScriptTransfer(i.caller, (bet * 2), assetID)] | |
15 | + | let winAmount = if ((randomNum > winProbability)) | |
16 | + | then winTransfer | |
17 | + | else 0 | |
18 | + | let writeLastPlay = [IntegerEntry("lastPlay", randomNum)] | |
19 | + | if ((winProbability > randomNum)) | |
20 | + | then $Tuple2(winTransfer, writeLastPlay) | |
21 | + | else $Tuple2([ScriptTransfer(i.caller, 0, assetID)], writeLastPlay) | |
32 | 22 | } | |
33 | 23 | ||
34 | 24 | ||
35 | 25 | @Verifier(tx) | |
36 | 26 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
37 | 27 |
github/deemru/w8io/169f3d6 27.98 ms ◑