tx · EToW9996YEmZaqjf5RMh4fWxAgcBxk7XSng7pWn7v3zu 3MweDUGicjorwUViyXBcfCM15fQXXEDU3gN: -0.01000000 Waves 2023.09.23 08:40 [2767611] smart account 3MweDUGicjorwUViyXBcfCM15fQXXEDU3gN > SELF 0.00000000 Waves
{ "type": 13, "id": "EToW9996YEmZaqjf5RMh4fWxAgcBxk7XSng7pWn7v3zu", "fee": 1000000, "feeAssetId": null, "timestamp": 1695447621940, "version": 2, "chainId": 84, "sender": "3MweDUGicjorwUViyXBcfCM15fQXXEDU3gN", "senderPublicKey": "DGFm8ntnNPVthPrdcaZNWKYZi1wYzD3vhJETwHnF2emk", "proofs": [ "3XwrRsVxHU6Xh63Fm7Mv6sLKohM7ioVnLmeXpCqKRf2xV68NYAxkZgHpSsWJnT2EiTDHCPtUXPnUmPfALX9nqHim" ], "script": "base64:AAIFAAAAAAAAAAkIAhIFCgMBAQEAAAAAAAAAAQAAAAFpAQAAAAx0ZXN0RnJhY3Rpb24AAAADAAAABXZhbHVlAAAACW51bWVyYXRvcgAAAAtkZW5vbWluYXRvcgQAAAALcmVzdWx0X2Rvd24JAQAAAAhmcmFjdGlvbgAAAAQFAAAABXZhbHVlBQAAAAludW1lcmF0b3IFAAAAC2Rlbm9taW5hdG9yBQAAAARET1dOBAAAAA1yZXN1bHRfaGFsZnVwCQEAAAAIZnJhY3Rpb24AAAAEBQAAAAV2YWx1ZQUAAAAJbnVtZXJhdG9yBQAAAAtkZW5vbWluYXRvcgUAAAAGSEFMRlVQBAAAAA9yZXN1bHRfaGFsZkV2ZW4JAQAAAAhmcmFjdGlvbgAAAAQFAAAABXZhbHVlBQAAAAludW1lcmF0b3IFAAAAC2Rlbm9taW5hdG9yBQAAAAhIQUxGRVZFTgQAAAAOcmVzdWx0X2NlaWxpbmcJAQAAAAhmcmFjdGlvbgAAAAQFAAAABXZhbHVlBQAAAAludW1lcmF0b3IFAAAAC2Rlbm9taW5hdG9yBQAAAAdDRUlMSU5HBAAAAAxyZXN1bHRfZmxvb3IJAQAAAAhmcmFjdGlvbgAAAAQFAAAABXZhbHVlBQAAAAludW1lcmF0b3IFAAAAC2Rlbm9taW5hdG9yBQAAAAVGTE9PUgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAALcmVzdWx0X2Rvd24FAAAAC3Jlc3VsdF9kb3duCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAA1yZXN1bHRfaGFsZnVwBQAAAA1yZXN1bHRfaGFsZnVwCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAA9yZXN1bHRfaGFsZmV2ZW4FAAAAD3Jlc3VsdF9oYWxmRXZlbgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAOcmVzdWx0X2NlaWxpbmcFAAAADnJlc3VsdF9jZWlsaW5nCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAAxyZXN1bHRfZmxvb3IFAAAADHJlc3VsdF9mbG9vcgUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkVtn+O", "height": 2767611, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ETRoECZU6TLbvmsqXvDkWqnodQdFVX5YLcCPQs5a9rd9 Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let isConstructedKey = "is_constructed" | |
5 | - | ||
6 | - | let assetIdKey = "assetId" | |
7 | - | ||
8 | - | let lpPoolAssetId = "lpPoolAssetId" | |
9 | - | ||
10 | - | let currentRewardAmountIdKey = "reward_amount_id" | |
11 | - | ||
12 | - | @Callable(i) | |
13 | - | func constructor () = if (isDefined(getBoolean(isConstructedKey))) | |
14 | - | then throw("Constructor can be called one time") | |
15 | - | else { | |
16 | - | let asset = Issue("WXTest", "", 1000000000000000, 8, false, unit, 0) | |
17 | - | let assetId = calculateAssetId(asset) | |
18 | - | [asset, StringEntry(assetIdKey, toBase58String(assetId)), BooleanEntry(isConstructedKey, true), IntegerEntry(currentRewardAmountIdKey, 0)] | |
19 | - | } | |
20 | - | ||
21 | 4 | ||
22 | 5 | ||
23 | 6 | @Callable(i) | |
24 | - | func issueLPAsset (recipient) = { | |
25 | - | let asset = Issue("LPPool", "", 1000000000000000, 8, false, unit, 0) | |
26 | - | let assetId = calculateAssetId(asset) | |
27 | - | [asset, StringEntry(lpPoolAssetId, toBase58String(assetId)), ScriptTransfer(Address(fromBase58String(recipient)), 1000000000000, assetId)] | |
28 | - | } | |
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | @Callable(i) | |
33 | - | func stakePoolLps (poolId) = [IntegerEntry("stakePoolLpsFuncCalled", height)] | |
34 | - | ||
35 | - | ||
36 | - | ||
37 | - | @Callable(i) | |
38 | - | func withdrawPoolLps (poolId) = [IntegerEntry("withdrawPoolLpsFuncCalled", height)] | |
39 | - | ||
40 | - | ||
41 | - | ||
42 | - | @Callable(i) | |
43 | - | func claimPoolRewards (poolId) = { | |
44 | - | let currentRewardAmountId = getIntegerValue(currentRewardAmountIdKey) | |
45 | - | let assetId = getStringValue(assetIdKey) | |
46 | - | let amount = if ((currentRewardAmountId == 0)) | |
47 | - | then 10000000000 | |
48 | - | else if ((currentRewardAmountId == 1)) | |
49 | - | then 20000000000 | |
50 | - | else if ((currentRewardAmountId == 2)) | |
51 | - | then 5000000000 | |
52 | - | else if ((currentRewardAmountId == 3)) | |
53 | - | then 35000000000 | |
54 | - | else 22000000000 | |
55 | - | let newCurrentRewardAmountId = if ((currentRewardAmountId == 4)) | |
56 | - | then 0 | |
57 | - | else (currentRewardAmountId + 1) | |
58 | - | [IntegerEntry(currentRewardAmountIdKey, newCurrentRewardAmountId), ScriptTransfer(i.caller, amount, fromBase58String(assetId))] | |
7 | + | func testFraction (value,numerator,denominator) = { | |
8 | + | let result_down = fraction(value, numerator, denominator, DOWN) | |
9 | + | let result_halfup = fraction(value, numerator, denominator, HALFUP) | |
10 | + | let result_halfEven = fraction(value, numerator, denominator, HALFEVEN) | |
11 | + | let result_ceiling = fraction(value, numerator, denominator, CEILING) | |
12 | + | let result_floor = fraction(value, numerator, denominator, FLOOR) | |
13 | + | [IntegerEntry("result_down", result_down), IntegerEntry("result_halfup", result_halfup), IntegerEntry("result_halfeven", result_halfEven), IntegerEntry("result_ceiling", result_ceiling), IntegerEntry("result_floor", result_floor)] | |
59 | 14 | } | |
60 | 15 | ||
61 | 16 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let isConstructedKey = "is_constructed" | |
5 | - | ||
6 | - | let assetIdKey = "assetId" | |
7 | - | ||
8 | - | let lpPoolAssetId = "lpPoolAssetId" | |
9 | - | ||
10 | - | let currentRewardAmountIdKey = "reward_amount_id" | |
11 | - | ||
12 | - | @Callable(i) | |
13 | - | func constructor () = if (isDefined(getBoolean(isConstructedKey))) | |
14 | - | then throw("Constructor can be called one time") | |
15 | - | else { | |
16 | - | let asset = Issue("WXTest", "", 1000000000000000, 8, false, unit, 0) | |
17 | - | let assetId = calculateAssetId(asset) | |
18 | - | [asset, StringEntry(assetIdKey, toBase58String(assetId)), BooleanEntry(isConstructedKey, true), IntegerEntry(currentRewardAmountIdKey, 0)] | |
19 | - | } | |
20 | - | ||
21 | 4 | ||
22 | 5 | ||
23 | 6 | @Callable(i) | |
24 | - | func issueLPAsset (recipient) = { | |
25 | - | let asset = Issue("LPPool", "", 1000000000000000, 8, false, unit, 0) | |
26 | - | let assetId = calculateAssetId(asset) | |
27 | - | [asset, StringEntry(lpPoolAssetId, toBase58String(assetId)), ScriptTransfer(Address(fromBase58String(recipient)), 1000000000000, assetId)] | |
28 | - | } | |
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | @Callable(i) | |
33 | - | func stakePoolLps (poolId) = [IntegerEntry("stakePoolLpsFuncCalled", height)] | |
34 | - | ||
35 | - | ||
36 | - | ||
37 | - | @Callable(i) | |
38 | - | func withdrawPoolLps (poolId) = [IntegerEntry("withdrawPoolLpsFuncCalled", height)] | |
39 | - | ||
40 | - | ||
41 | - | ||
42 | - | @Callable(i) | |
43 | - | func claimPoolRewards (poolId) = { | |
44 | - | let currentRewardAmountId = getIntegerValue(currentRewardAmountIdKey) | |
45 | - | let assetId = getStringValue(assetIdKey) | |
46 | - | let amount = if ((currentRewardAmountId == 0)) | |
47 | - | then 10000000000 | |
48 | - | else if ((currentRewardAmountId == 1)) | |
49 | - | then 20000000000 | |
50 | - | else if ((currentRewardAmountId == 2)) | |
51 | - | then 5000000000 | |
52 | - | else if ((currentRewardAmountId == 3)) | |
53 | - | then 35000000000 | |
54 | - | else 22000000000 | |
55 | - | let newCurrentRewardAmountId = if ((currentRewardAmountId == 4)) | |
56 | - | then 0 | |
57 | - | else (currentRewardAmountId + 1) | |
58 | - | [IntegerEntry(currentRewardAmountIdKey, newCurrentRewardAmountId), ScriptTransfer(i.caller, amount, fromBase58String(assetId))] | |
7 | + | func testFraction (value,numerator,denominator) = { | |
8 | + | let result_down = fraction(value, numerator, denominator, DOWN) | |
9 | + | let result_halfup = fraction(value, numerator, denominator, HALFUP) | |
10 | + | let result_halfEven = fraction(value, numerator, denominator, HALFEVEN) | |
11 | + | let result_ceiling = fraction(value, numerator, denominator, CEILING) | |
12 | + | let result_floor = fraction(value, numerator, denominator, FLOOR) | |
13 | + | [IntegerEntry("result_down", result_down), IntegerEntry("result_halfup", result_halfup), IntegerEntry("result_halfeven", result_halfEven), IntegerEntry("result_ceiling", result_ceiling), IntegerEntry("result_floor", result_floor)] | |
59 | 14 | } | |
60 | 15 | ||
61 | 16 | ||
62 | 17 | @Verifier(tx) | |
63 | 18 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
64 | 19 |
github/deemru/w8io/026f985 57.06 ms ◑