Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated price discovery #991

Open
wants to merge 16 commits into
base: rc/v3.0.2
Choose a base branch
from
Open

Conversation

dorin-iancu
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Jan 10, 2025

Coverage Summary

Totals

Count Covered %
Lines 42759 38589 90.25
Regions 6935 4916 70.89
Functions 3184 2013 63.22
Instantiations 25428 5962 23.45

Files

Expand
File Lines Regions Functions Instantiations
/common/common_structs/src/farm_types.rs 78.95% 52.94% 42.86% 26.84%
/common/common_structs/src/locked_token_types.rs 35.48% 24.24% 12.50% 5.03%
/common/common_structs/src/wrapper_types.rs 46.30% 23.33% 14.29% 5.13%
/common/modules/farm/config/src/config.rs 52.38% 69.23% 60.00% 38.56%
/common/modules/farm/contexts/src/claim_rewards_context.rs 93.55% 77.78% 100.00% 70.59%
/common/modules/farm/contexts/src/enter_farm_context.rs 91.67% 81.82% 100.00% 81.25%
/common/modules/farm/contexts/src/exit_farm_context.rs 95.24% 66.67% 100.00% 76.47%
/common/modules/farm/contexts/src/storage_cache.rs 100.00% 100.00% 100.00% 82.35%
/common/modules/farm/events/src/events.rs 93.33% 35.71% 35.71% 34.68%
/common/modules/farm/farm_base_impl/src/base_farm_init.rs 75.86% 50.00% 33.33% 42.11%
/common/modules/farm/farm_base_impl/src/base_farm_validation.rs 57.14% 33.33% 33.33% 19.44%
/common/modules/farm/farm_base_impl/src/base_traits_impl.rs 84.97% 82.61% 78.57% 69.74%
/common/modules/farm/farm_base_impl/src/claim_rewards.rs 97.37% 50.00% 50.00% 40.38%
/common/modules/farm/farm_base_impl/src/compound_rewards.rs 95.24% 40.00% 33.33% 11.76%
/common/modules/farm/farm_base_impl/src/enter_farm.rs 96.00% 33.33% 33.33% 36.84%
/common/modules/farm/farm_base_impl/src/exit_farm.rs 96.43% 33.33% 33.33% 34.21%
/common/modules/farm/farm_base_impl/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/common/modules/farm/farm_token/src/farm_token.rs 2.04% 5.56% 9.09% 21.90%
/common/modules/farm/rewards/src/rewards.rs 18.75% 33.33% 50.00% 32.28%
/common/modules/legacy_token_decode_module/src/lib.rs 80.00% 60.00% 33.33% 1.16%
/common/modules/locking_module/src/lock_with_energy_module.rs 95.00% 85.71% 83.33% 20.00%
/common/modules/locking_module/src/locking_module.rs 0.00% 0.00% 0.00% 0.00%
/common/modules/math/src/lib.rs 79.55% 80.00% 75.00% 39.73%
/common/modules/original_owner_helper/src/lib.rs 94.74% 88.89% 50.00% 6.74%
/common/modules/pausable/src/pausable.rs 57.89% 36.36% 50.00% 12.22%
/common/modules/permissions_hub_module/src/permissions_hub_module.rs 91.67% 75.00% 75.00% 16.00%
/common/modules/permissions_module/src/permissions.rs 68.42% 66.67% 50.00% 55.38%
/common/modules/permissions_module/src/permissions_module.rs 58.70% 63.64% 62.50% 20.84%
/common/modules/sc_whitelist_module/src/sc_whitelist_module.rs 65.00% 53.85% 57.14% 13.87%
/common/modules/token_merge_helper/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/common/modules/token_send/src/token_send.rs 87.50% 80.00% 60.00% 27.50%
/common/modules/utils/src/lib.rs 93.22% 79.17% 76.92% 36.53%
/common/traits/fixed-supply-token/src/lib.rs 95.00% 85.71% 100.00% 57.14%
/common/traits/mergeable/src/lib.rs 55.88% 47.06% 57.14% 17.70%
/common/traits/unwrappable/src/lib.rs 75.00% 66.67% 50.00% 24.53%
/dex/farm-with-locked-rewards/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/dex/farm-with-locked-rewards/src/external_interaction.rs 92.59% 78.57% 50.00% 6.06%
/dex/farm-with-locked-rewards/src/lib.rs 88.98% 76.32% 71.43% 28.96%
/dex/farm-with-locked-rewards/tests/farm_with_locked_rewards_setup/fees_collector_mock.rs 50.00% 50.00% 50.00% 50.00%
/dex/farm-with-locked-rewards/tests/farm_with_locked_rewards_setup/mod.rs 100.00% 100.00% 100.00% 100.00%
/dex/farm-with-locked-rewards/tests/farm_with_locked_rewards_test.rs 100.00% 100.00% 100.00% 100.00%
/dex/farm/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/dex/farm/src/base_functions.rs 94.87% 88.89% 81.82% 49.82%
/dex/farm/src/exit_penalty.rs 50.00% 25.00% 33.33% 23.05%
/dex/farm/src/external_interaction.rs 95.35% 50.00% 50.00% 3.45%
/dex/farm/src/lib.rs 91.07% 80.77% 81.25% 19.60%
/dex/farm/tests/energy_update_test.rs 100.00% 100.00% 100.00% 100.00%
/dex/farm/tests/external_interaction_test.rs 100.00% 100.00% 100.00% 100.00%
/dex/farm/tests/farm_multi_user_test.rs 100.00% 100.00% 100.00% 100.00%
/dex/farm/tests/farm_review_distribution.rs 100.00% 100.00% 100.00% 100.00%
/dex/farm/tests/farm_setup/farm_rewards_distr_setup.rs 96.96% 94.59% 94.12% 15.69%
/dex/farm/tests/farm_setup/multi_user_farm_setup.rs 97.50% 97.97% 96.83% 27.25%
/dex/farm/tests/farm_setup/single_user_farm_setup.rs 89.18% 87.23% 87.50% 14.58%
/dex/farm/tests/farm_single_user_test.rs 100.00% 100.00% 100.00% 100.00%
/dex/farm/tests/total_farm_position_test.rs 100.00% 100.00% 100.00% 100.00%
/dex/fuzz/src/fuzz_data.rs 99.64% 91.67% 87.50% 87.50%
/dex/fuzz/src/fuzz_farm.rs 94.19% 83.78% 100.00% 100.00%
/dex/fuzz/src/fuzz_pair.rs 90.61% 74.51% 100.00% 100.00%
/dex/fuzz/src/fuzz_start.rs 99.36% 94.74% 100.00% 100.00%
/dex/governance/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/dex/governance/src/config.rs 50.82% 75.00% 52.94% 15.00%
/dex/governance/src/events.rs 97.96% 87.50% 83.33% 32.14%
/dex/governance/src/lib.rs 98.90% 95.45% 88.89% 13.79%
/dex/governance/src/proposal.rs 65.22% 45.71% 19.05% 5.80%
/dex/governance/src/validation.rs 75.00% 33.33% 33.33% 12.50%
/dex/governance/src/vote.rs 80.00% 25.00% 25.00% 12.00%
/dex/governance/src/weight.rs 75.00% 62.50% 80.00% 32.00%
/dex/governance/tests/gov_tests.rs 100.00% 100.00% 100.00% 100.00%
/dex/pair-mock/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/dex/pair-mock/src/pair.rs 45.45% 17.65% 60.00% 21.57%
/dex/pair/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/dex/pair/src/amm.rs 92.00% 75.00% 75.00% 28.24%
/dex/pair/src/config.rs 56.25% 55.56% 50.00% 26.89%
/dex/pair/src/contexts/add_liquidity.rs 100.00% 100.00% 100.00% 63.64%
/dex/pair/src/contexts/base.rs 100.00% 100.00% 100.00% 50.65%
/dex/pair/src/contexts/output_builder.rs 98.00% 84.62% 80.00% 35.51%
/dex/pair/src/contexts/remove_liquidity.rs 100.00% 100.00% 100.00% 45.45%
/dex/pair/src/contexts/swap.rs 100.00% 100.00% 100.00% 45.45%
/dex/pair/src/events.rs 72.82% 28.57% 28.57% 21.38%
/dex/pair/src/fee.rs 39.57% 35.58% 46.15% 6.25%
/dex/pair/src/lib.rs 70.00% 53.57% 75.00% 30.22%
/dex/pair/src/liquidity_pool.rs 92.19% 66.67% 80.00% 29.91%
/dex/pair/src/locking_wrapper.rs 92.11% 81.82% 80.00% 8.19%
/dex/pair/src/pair_actions/add_liq.rs 91.36% 65.38% 66.67% 27.66%
/dex/pair/src/pair_actions/common_methods.rs 66.67% 60.00% 50.00% 19.05%
/dex/pair/src/pair_actions/initial_liq.rs 87.93% 57.89% 33.33% 2.22%
/dex/pair/src/pair_actions/remove_liq.rs 91.82% 62.96% 75.00% 16.09%
/dex/pair/src/pair_actions/swap.rs 73.36% 52.54% 45.45% 15.27%
/dex/pair/src/pair_actions/views.rs 74.24% 72.50% 71.43% 5.96%
/dex/pair/src/read_pair_storage.rs 93.75% 75.00% 75.00% 11.97%
/dex/pair/src/safe_price.rs 90.11% 72.55% 54.55% 22.62%
/dex/pair/src/safe_price_view.rs 86.13% 67.03% 80.00% 6.27%
/dex/pair/tests/pair_rs_test.rs 99.86% 97.59% 93.94% 93.94%
/dex/pair/tests/pair_setup/mod.rs 100.00% 100.00% 100.00% 100.00%
/dex/permissions-hub/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/dex/permissions-hub/src/lib.rs 81.48% 78.57% 57.14% 19.41%
/dex/price-discovery/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/dex/price-discovery/src/common_storage.rs 50.00% 50.00% 50.00% 19.51%
/dex/price-discovery/src/events.rs 88.89% 38.89% 38.89% 15.94%
/dex/price-discovery/src/lib.rs 97.22% 90.91% 66.67% 4.35%
/dex/price-discovery/src/phase.rs 88.24% 80.95% 55.56% 10.71%
/dex/price-discovery/src/redeem_token.rs 60.00% 80.00% 75.00% 12.50%
/dex/price-discovery/src/user_actions/owner_deposit_withdraw.rs 92.00% 75.00% 66.67% 10.81%
/dex/price-discovery/src/user_actions/redeem.rs 97.30% 76.92% 66.67% 13.33%
/dex/price-discovery/src/user_actions/user_deposit_withdraw.rs 95.45% 75.00% 66.67% 10.81%
/dex/price-discovery/src/views.rs 0.00% 0.00% 0.00% 0.00%
/dex/price-discovery/tests/price_disc_tests.rs 100.00% 100.00% 100.00% 100.00%
/dex/price-discovery/tests/tests_common.rs 100.00% 100.00% 100.00% 50.00%
/dex/proxy-deployer/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/dex/proxy-deployer/src/farm_deploy.rs 0.00% 0.00% 0.00% 0.00%
/dex/proxy-deployer/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/dex/router/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/dex/router/src/config.rs 82.14% 60.00% 50.00% 16.41%
/dex/router/src/contract.rs 53.48% 60.94% 73.33% 13.02%
/dex/router/src/enable_swap_by_user.rs 91.88% 73.91% 70.59% 11.67%
/dex/router/src/events.rs 88.57% 38.46% 36.36% 12.90%
/dex/router/src/factory.rs 59.84% 31.11% 25.00% 8.33%
/dex/router/src/multi_pair_swap.rs 63.49% 63.16% 60.00% 11.11%
/dex/router/tests/router_setup/mod.rs 100.00% 100.00% 100.00% 100.00%
/dex/router/tests/router_test.rs 100.00% 100.00% 100.00% 100.00%
/dex/tests/dex_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/dex/tests/dex_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/energy-integration/common-modules/energy-query/src/lib.rs 95.65% 88.24% 90.00% 34.66%
/energy-integration/common-modules/week-timekeeping/src/lib.rs 60.00% 40.00% 50.00% 29.26%
/energy-integration/common-modules/weekly-rewards-splitting/src/base_impl.rs 100.00% 93.75% 100.00% 44.68%
/energy-integration/common-modules/weekly-rewards-splitting/src/events.rs 90.91% 85.71% 80.00% 42.13%
/energy-integration/common-modules/weekly-rewards-splitting/src/global_info.rs 99.07% 96.55% 87.50% 46.33%
/energy-integration/common-modules/weekly-rewards-splitting/src/lib.rs 77.00% 61.11% 36.36% 11.41%
/energy-integration/common-modules/weekly-rewards-splitting/src/locked_token_buckets.rs 95.29% 89.74% 75.00% 38.64%
/energy-integration/common-modules/weekly-rewards-splitting/src/update_claim_progress_energy.rs 92.75% 89.66% 83.33% 30.27%
/energy-integration/common-types/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/energy-integration/energy-factory-mock/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/energy-integration/energy-factory-mock/src/lib.rs 13.64% 25.00% 33.33% 13.22%
/energy-integration/energy-update/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/energy-integration/energy-update/src/lib.rs 11.11% 16.67% 33.33% 6.45%
/energy-integration/farm-boosted-yields/src/boosted_yields_factors.rs 85.47% 65.96% 47.62% 23.59%
/energy-integration/farm-boosted-yields/src/lib.rs 96.39% 90.00% 92.86% 31.60%
/energy-integration/fees-collector/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/energy-integration/fees-collector/src/additional_locked_tokens.rs 95.83% 87.50% 80.00% 13.85%
/energy-integration/fees-collector/src/config.rs 27.50% 33.33% 28.57% 10.34%
/energy-integration/fees-collector/src/events.rs 75.00% 66.67% 66.67% 12.12%
/energy-integration/fees-collector/src/fees_accumulation.rs 97.22% 92.86% 80.00% 16.67%
/energy-integration/fees-collector/src/lib.rs 94.44% 89.19% 77.78% 16.78%
/energy-integration/fees-collector/tests/fees_collector_rust_test.rs 100.00% 100.00% 100.00% 100.00%
/energy-integration/fees-collector/tests/fees_collector_test_setup/mod.rs 100.00% 100.00% 100.00% 100.00%
/energy-integration/governance-v2/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/energy-integration/governance-v2/src/configurable.rs 79.63% 73.91% 62.50% 16.00%
/energy-integration/governance-v2/src/events.rs 50.00% 50.00% 50.00% 29.17%
/energy-integration/governance-v2/src/lib.rs 97.52% 90.57% 92.31% 19.35%
/energy-integration/governance-v2/src/proposal.rs 59.32% 22.22% 22.22% 13.79%
/energy-integration/governance-v2/src/proposal_storage.rs 70.37% 38.46% 38.46% 14.89%
/energy-integration/governance-v2/src/views.rs 93.85% 88.46% 80.00% 23.68%
/energy-integration/governance-v2/tests/gov_rust_test.rs 98.14% 84.44% 100.00% 100.00%
/energy-integration/governance-v2/tests/gov_test_setup/mod.rs 99.64% 98.08% 100.00% 100.00%
/farm-staking/farm-staking-proxy/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/farm-staking/farm-staking-proxy/src/dual_yield_token.rs 62.16% 58.33% 44.44% 13.33%
/farm-staking/farm-staking-proxy/src/external_contracts_interactions.rs 96.12% 78.26% 90.00% 26.56%
/farm-staking/farm-staking-proxy/src/lib.rs 96.00% 66.67% 66.67% 7.69%
/farm-staking/farm-staking-proxy/src/lp_farm_token.rs 92.31% 66.67% 66.67% 11.11%
/farm-staking/farm-staking-proxy/src/proxy_actions/claim.rs 96.77% 50.00% 50.00% 14.29%
/farm-staking/farm-staking-proxy/src/proxy_actions/external_interaction.rs 97.33% 81.82% 66.67% 18.18%
/farm-staking/farm-staking-proxy/src/proxy_actions/stake.rs 97.44% 77.78% 50.00% 14.29%
/farm-staking/farm-staking-proxy/src/proxy_actions/unstake.rs 95.45% 33.33% 33.33% 8.33%
/farm-staking/farm-staking-proxy/src/result_types.rs 60.61% 18.75% 18.75% 13.64%
/farm-staking/farm-staking-proxy/tests/staking_farm_with_lp.rs 100.00% 100.00% 100.00% 100.00%
/farm-staking/farm-staking-proxy/tests/staking_farm_with_lp_external_contracts/mod.rs 100.00% 100.00% 100.00% 100.00%
/farm-staking/farm-staking-proxy/tests/staking_farm_with_lp_staking_contract_interactions/mod.rs 100.00% 100.00% 100.00% 100.00%
/farm-staking/farm-staking-proxy/tests/staking_farm_with_lp_staking_contract_setup/mod.rs 100.00% 100.00% 100.00% 100.00%
/farm-staking/farm-staking/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/farm-staking/farm-staking/src/base_impl_wrapper.rs 96.72% 94.74% 92.31% 71.43%
/farm-staking/farm-staking/src/claim_only_boosted_staking_rewards.rs 92.65% 88.89% 75.00% 39.47%
/farm-staking/farm-staking/src/claim_stake_farm_rewards.rs 98.39% 83.33% 83.33% 24.32%
/farm-staking/farm-staking/src/compound_stake_farm_rewards.rs 91.67% 33.33% 33.33% 11.11%
/farm-staking/farm-staking/src/custom_rewards.rs 55.07% 52.38% 46.15% 15.67%
/farm-staking/farm-staking/src/external_interaction.rs 97.47% 50.00% 50.00% 7.14%
/farm-staking/farm-staking/src/farm_token_roles.rs 0.00% 0.00% 0.00% 0.00%
/farm-staking/farm-staking/src/lib.rs 69.23% 69.23% 60.00% 18.18%
/farm-staking/farm-staking/src/stake_farm.rs 97.92% 80.00% 80.00% 27.27%
/farm-staking/farm-staking/src/token_attributes.rs 76.47% 56.10% 40.00% 32.91%
/farm-staking/farm-staking/src/unbond_farm.rs 92.31% 50.00% 33.33% 11.11%
/farm-staking/farm-staking/src/unstake_farm.rs 98.48% 85.71% 83.33% 32.43%
/farm-staking/farm-staking/tests/farm_staking_energy_test.rs 100.00% 100.00% 100.00% 100.00%
/farm-staking/farm-staking/tests/farm_staking_setup/mod.rs 100.00% 100.00% 100.00% 62.28%
/farm-staking/farm-staking/tests/farm_staking_test.rs 100.00% 100.00% 100.00% 100.00%
/legacy-contracts/factory-legacy/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/factory-legacy/src/attr_ex_helper.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/factory-legacy/src/cache.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/factory-legacy/src/events.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/factory-legacy/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/factory-legacy/src/locked_asset.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/factory-legacy/src/locked_asset_token_merge.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/factory-legacy/src/migration.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-staking-proxy-v13/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-staking-proxy-v13/src/dual_yield_token.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-staking-proxy-v13/src/external_contracts_interactions.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-staking-proxy-v13/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-staking-proxy-v13/src/lp_farm_token.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-v12/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-v12/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-v13-custom-rewards/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-v13-custom-rewards/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-v13-locked-rewards/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-v13-locked-rewards/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-v13/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/farm-v13/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/locked-asset-distribution/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/locked-asset-distribution/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/metabonding-staking-legacy/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/metabonding-staking-legacy/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/price-discovery-v1/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/price-discovery-v1/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/price-discovery-v2/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/price-discovery-v2/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/proxy-dex-legacy/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/proxy-dex-legacy/src/energy_update.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/proxy-dex-legacy/src/events.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/proxy-dex-legacy/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/proxy-dex-legacy/src/proxy_common.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/proxy-dex-legacy/src/proxy_farm.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/proxy-dex-legacy/src/proxy_pair.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/proxy-dex-legacy/src/transfer_role.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/simple-lock-legacy/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/legacy-contracts/simple-lock-legacy/src/basic_lock_unlock.rs 90.62% 55.56% 60.00% 15.00%
/legacy-contracts/simple-lock-legacy/src/lib.rs 80.00% 66.67% 75.00% 5.36%
/legacy-contracts/simple-lock-legacy/src/locked_token.rs 14.29% 14.29% 14.29% 2.44%
/legacy-contracts/simple-lock-legacy/src/proxy_farm.rs 82.14% 31.25% 28.57% 5.88%
/legacy-contracts/simple-lock-legacy/src/proxy_lp.rs 83.78% 33.33% 33.33% 6.38%
/legacy-contracts/simple-lock-legacy/tests/rust_test.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/energy-factory/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/locked-asset/energy-factory/src/energy.rs 95.57% 85.42% 78.57% 35.24%
/locked-asset/energy-factory/src/events.rs 76.47% 33.33% 33.33% 24.07%
/locked-asset/energy-factory/src/extend_lock.rs 96.23% 84.62% 71.43% 27.88%
/locked-asset/energy-factory/src/lib.rs 99.31% 96.55% 88.89% 24.57%
/locked-asset/energy-factory/src/local_roles.rs 0.00% 0.00% 0.00% 0.00%
/locked-asset/energy-factory/src/lock_options.rs 78.95% 66.67% 45.45% 29.31%
/locked-asset/energy-factory/src/lock_options_endpoints.rs 88.00% 82.76% 66.67% 33.78%
/locked-asset/energy-factory/src/locked_token_transfer.rs 68.42% 54.55% 60.00% 10.53%
/locked-asset/energy-factory/src/migration.rs 73.68% 61.36% 63.64% 11.23%
/locked-asset/energy-factory/src/penalty.rs 94.44% 84.62% 33.33% 7.50%
/locked-asset/energy-factory/src/token_merging.rs 95.15% 76.19% 70.00% 13.89%
/locked-asset/energy-factory/src/token_whitelist.rs 80.00% 66.67% 66.67% 24.31%
/locked-asset/energy-factory/src/unlock_with_penalty.rs 97.41% 80.00% 71.43% 7.93%
/locked-asset/energy-factory/src/unstake.rs 97.22% 87.50% 87.50% 13.67%
/locked-asset/energy-factory/src/virtual_lock.rs 97.50% 87.50% 75.00% 21.69%
/locked-asset/energy-factory/tests/energy_factory_setup/mod.rs 99.64% 97.83% 100.00% 41.00%
/locked-asset/energy-factory/tests/energy_factory_setup/unbond_sc_mock.rs 100.00% 100.00% 100.00% 50.00%
/locked-asset/energy-factory/tests/old_tokens_test.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/energy-factory/tests/simple_lock_energy_test.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/energy-factory/tests/token_merging_test.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/energy-factory/tests/virtual_lock_test.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/lkmex-transfer/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/locked-asset/lkmex-transfer/src/energy_transfer.rs 95.45% 87.50% 60.00% 25.00%
/locked-asset/lkmex-transfer/src/events.rs 88.00% 57.14% 57.14% 15.00%
/locked-asset/lkmex-transfer/src/lib.rs 78.26% 47.50% 35.00% 9.09%
/locked-asset/lkmex-transfer/tests/lkmex_transfer_tests.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/locked-token-wrapper/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/locked-asset/locked-token-wrapper/src/lib.rs 97.30% 83.33% 80.00% 6.06%
/locked-asset/locked-token-wrapper/src/wrapped_token.rs 43.75% 18.75% 27.27% 4.29%
/locked-asset/locked-token-wrapper/tests/locked_token_wrapping_test.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/proxy_dex/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/locked-asset/proxy_dex/src/energy_update.rs 70.45% 38.89% 66.67% 28.57%
/locked-asset/proxy_dex/src/events.rs 74.36% 30.00% 30.00% 12.24%
/locked-asset/proxy_dex/src/external_merging.rs 100.00% 100.00% 100.00% 41.67%
/locked-asset/proxy_dex/src/farm_interactions.rs 97.44% 80.00% 80.00% 11.11%
/locked-asset/proxy_dex/src/lib.rs 19.35% 10.53% 25.00% 3.85%
/locked-asset/proxy_dex/src/other_sc_whitelist.rs 50.00% 37.50% 37.50% 7.00%
/locked-asset/proxy_dex/src/pair_interactions.rs 98.00% 75.00% 75.00% 15.62%
/locked-asset/proxy_dex/src/proxy_common.rs 58.02% 58.82% 72.73% 17.86%
/locked-asset/proxy_dex/src/proxy_farm.rs 99.38% 94.12% 80.00% 10.53%
/locked-asset/proxy_dex/src/proxy_pair.rs 88.55% 80.00% 75.00% 15.00%
/locked-asset/proxy_dex/src/wrapped_farm_attributes.rs 86.36% 77.78% 58.33% 21.69%
/locked-asset/proxy_dex/src/wrapped_farm_token_merge.rs 94.64% 57.14% 60.00% 9.38%
/locked-asset/proxy_dex/src/wrapped_lp_attributes.rs 94.57% 77.27% 58.33% 24.47%
/locked-asset/proxy_dex/src/wrapped_lp_token_merge.rs 63.27% 42.86% 40.00% 6.25%
/locked-asset/proxy_dex/tests/proxy_dex_test_setup/mod.rs 99.31% 97.06% 94.74% 92.11%
/locked-asset/proxy_dex/tests/proxy_farm_test.rs 99.93% 99.26% 100.00% 100.00%
/locked-asset/proxy_dex/tests/proxy_lp_test.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/simple-lock/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/locked-asset/simple-lock/src/basic_lock_unlock.rs 96.88% 73.33% 71.43% 27.50%
/locked-asset/simple-lock/src/farm_interactions.rs 98.53% 90.00% 83.33% 16.07%
/locked-asset/simple-lock/src/lib.rs 85.71% 71.43% 80.00% 13.25%
/locked-asset/simple-lock/src/locked_token.rs 71.88% 73.33% 41.67% 9.13%
/locked-asset/simple-lock/src/lp_interactions.rs 94.55% 72.73% 80.00% 9.18%
/locked-asset/simple-lock/src/proxy_farm.rs 78.34% 56.86% 36.84% 6.61%
/locked-asset/simple-lock/src/proxy_lp.rs 79.06% 48.84% 52.94% 6.13%
/locked-asset/simple-lock/src/token_attributes.rs 93.10% 71.43% 50.00% 22.00%
/locked-asset/simple-lock/tests/rust_test.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/tests/distribution_scenario_go_test.rs 0.00% 0.00% 0.00% 0.00%
/locked-asset/token-unstake/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/locked-asset/token-unstake/src/cancel_unstake.rs 83.67% 70.00% 33.33% 6.67%
/locked-asset/token-unstake/src/events.rs 90.00% 66.67% 66.67% 21.05%
/locked-asset/token-unstake/src/fees_handler.rs 96.83% 85.71% 87.50% 40.58%
/locked-asset/token-unstake/src/lib.rs 92.31% 75.00% 66.67% 18.75%
/locked-asset/token-unstake/src/tokens_per_user.rs 25.00% 25.00% 25.00% 41.10%
/locked-asset/token-unstake/src/unbond_tokens.rs 96.15% 82.35% 50.00% 22.22%
/locked-asset/token-unstake/tests/token_unstake_setup/fees_collector_mock.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/token-unstake/tests/token_unstake_setup/mod.rs 93.33% 88.89% 86.36% 63.64%
/locked-asset/token-unstake/tests/token_unstake_test.rs 100.00% 100.00% 100.00% 100.00%
/locked-asset/token-unstake/tests/unlock_early_test.rs 100.00% 100.00% 100.00% 100.00%
/pause-all/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/pause-all/src/lib.rs 68.83% 55.81% 69.23% 17.58%
/pause-all/src/ongoing_pause_operation.rs 50.00% 33.33% 33.33% 14.29%
/pause-all/tests/pause_all_test.rs 100.00% 100.00% 100.00% 100.00%

Copy link

github-actions bot commented Jan 10, 2025

Contract comparison - from 58a7e74 to 6eae83b

Path                                                                                             size                  has-allocator                     has-format
farm-staking.wasm 44172 false without message
farm-staking-proxy.wasm 21055 false without message
simple-lock.wasm 25649 false without message
energy-factory.wasm 34286 false without message
token-unstake.wasm 13953 false without message
lkmex-transfer.wasm 10968 false without message
proxy_dex.wasm 36866 false without message
locked-token-wrapper.wasm 15151 false without message
energy-update.wasm 1571 false none
governance-v2.wasm 16308 false without message
fees-collector.wasm 18543 false without message
energy-factory-mock.wasm 4051 false without message
router.wasm 26467 false without message
pair-mock.wasm 4386 false without message
permissions-hub.wasm 3291 false none
proxy-deployer.wasm 4047 false none
farm.wasm 40425 false without message
price-discovery.wasm 16609 ➡️ 13533 🟢 (-3076) false without message
farm-with-locked-rewards.wasm 40290 false without message
safe-price-view.wasm 8385 false without message
pair.wasm 32179 false without message
pair-full.wasm 33551 false without message
governance.wasm 16665 false without message
farm-v13-locked-rewards.wasm 6150 false without message
price-discovery-v1.wasm 3064 false none
farm-v13-custom-rewards.wasm 3732 false without message
proxy-dex-legacy.wasm 18764 false without message
factory-legacy.wasm 18450 false without message
metabonding-staking-legacy.wasm 2126 false none
farm-staking-proxy-v13.wasm 10102 false without message
farm-v13.wasm 6195 false without message
locked-asset-distribution.wasm 6007 false without message
price-discovery-v2.wasm 3475 false none
farm-v12.wasm 2235 false none
simple-lock-legacy.wasm 6616 false without message
pause-all.wasm 5873 false without message

@dorin-iancu dorin-iancu marked this pull request as ready for review January 13, 2025 08:00

```rust
#[init]
fn init(
&self,
launched_token_id: TokenIdentifier,
accepted_token_id: TokenIdentifier,
accepted_token_id: EgldOrEsdtTokenIdentifier,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, use EgldOrEsdtTokenIdentifier for all args.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, you can't launch EGLD, so this makes it a bit more clear.

bought_token_id: EgldOrEsdtTokenIdentifier<M>,
bought_token_amount: BigUint<M>,
pub struct OwnerDepositEvent<'a, M: ManagedTypeApi> {
token_amount_in: &'a BigUint<M>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lifetime of objects was hidden on purpose in the framework.
Is there a way to avoid this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. Lifetime is hidden when you call the respective helper functions, not when you define the struct.

let min_launched_tokens = self.min_launched_tokens().get();
let current_total_launched_tokens = self.launched_token_balance().get();
require!(
&current_total_launched_tokens + &payment_amount >= min_launched_tokens,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the same naming for variables.
current_total_launched_tokens, min_launched_tokens - change this to amount;
or
payment_amount - change this to tokens.

It's easier for the reviewer or the next developer to read and understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


fn owner_redeem(&self, owner: &ManagedAddress) -> EgldOrEsdtTokenPayment {
let launched_token_supply = self.launched_token_balance().get();
require!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be moved in the caller function redeem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I purposefully kept it in a different function.

payment_result
}

/// Deposit ESDT received after deposit to withdraw the initially deposited tokens.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already did? What were you expecting the comment to say?


self.burn_redeem_token(&payment_amount);
self.accepted_token_balance()
.update(|balance| *balance -= &payment_amount);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifiy that balance is greater than payment_amount.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's really no need for that. This should never fail, and even if it does, the framework has checks for BigUint diff being lower than 0.

Copy link
Contributor

@psorinionut psorinionut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

require!(payment_token == &redeem_token_id, INVALID_PAYMENT_ERR_MSG);

let launched_token_supply = self.launched_token_balance().get();
if launched_token_supply == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could you get to this situation? What if launched_token_supply is > 0 but < than the SC balance?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the owner doesn't deposit any tokens. I'm not sure I get the second question? How would you ever reach such a situation?

-> SingleValueMapper<BigUint>;
fn redeem_token_total_circulating_supply(&self) -> SingleValueMapper<BigUint>;

// TODO: Save launched token balance somewhere
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still relevant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. Removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants