Skip to content

Add Potlock contract #76

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

Open
wants to merge 59 commits into
base: main
Choose a base branch
from
Open

Add Potlock contract #76

wants to merge 59 commits into from

Conversation

CostinCarabas
Copy link
Contributor

No description provided.

@CostinCarabas CostinCarabas changed the base branch from main to fix-unit-tests June 20, 2024 10:07
fn project_donations(
&self,
project_id: ProjectId,
) -> MapMapper<ManagedAddress, EsdtTokenPayment>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless you've got no other choice, avoid MapMapper.

Comment on lines 42 to 45
let project_id = self.projects().len() + 1;
let owner = self.blockchain().get_caller();
let project = Project::new(project_id, potlock_id, project_name, description, owner);
self.projects().push(&project);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this respects the specs. I don't see where an admin/owner can accept/reject an application. Docs say this:

ApplyForPot@potID@projectName@description - anyone can submit application, but an authority will review the submission and evaluate for eligibility and potential impact

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new function for Project::new will create a Project with Status = Inactive.
An authority would have to call endpoint(acceptApplication) to set the project status to Active

Base automatically changed from fix-unit-tests to unified-syntax-refactor July 2, 2024 14:15
Base automatically changed from unified-syntax-refactor to framework-upgrade-0.50.4 July 2, 2024 14:28
Base automatically changed from framework-upgrade-0.50.4 to main July 3, 2024 06:31
Copy link

github-actions bot commented Jul 19, 2024

Coverage Summary

Totals

Count Covered %
Lines 24697 15458 62.59
Regions 5550 2996 53.98
Functions 2828 1451 51.31
Instantiations 9417 2340 24.85

Files

Expand
File Lines Regions Functions Instantiations
/contracts/adder/interactor/src/basic_interactor.rs 0.00% 0.00% 0.00% 0.00%
/contracts/adder/interactor/src/basic_interactor_cli.rs 0.00% 0.00% 0.00% 0.00%
/contracts/adder/interactor/src/basic_interactor_config.rs 0.00% 0.00% 0.00% 0.00%
/contracts/adder/interactor/src/basic_interactor_main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/adder/interactor/src/basic_interactor_state.rs 0.00% 0.00% 0.00% 0.00%
/contracts/adder/interactor/tests/basic_interactor_cs_test.rs 0.00% 0.00% 0.00% 0.00%
/contracts/adder/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/adder/src/adder.rs 100.00% 100.00% 100.00% 60.65%
/contracts/adder/src/adder_proxy.rs 100.00% 100.00% 100.00% 65.71%
/contracts/adder/tests/adder_blackbox_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/adder/tests/adder_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/adder/tests/adder_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/adder/tests/adder_unit_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/adder/tests/adder_whitebox_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/bonding-curve-contract/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/bonding-curve-contract/src/bonding_curve_contract.rs 83.33% 77.78% 77.78% 23.81%
/contracts/bonding-curve-contract/src/function_selector.rs 68.42% 40.00% 16.67% 10.00%
/contracts/bonding-curve-contract/tests/bonding_curve_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/bonding-curve-contract/tests/bonding_curve_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/check-pause/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/check-pause/src/check_pause.rs 75.00% 66.67% 66.67% 18.52%
/contracts/crowdfunding-esdt/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crowdfunding-esdt/src/crowdfunding_esdt.rs 96.97% 88.89% 81.82% 43.08%
/contracts/crowdfunding-esdt/src/crowdfunding_esdt_proxy.rs 62.22% 50.00% 50.00% 45.45%
/contracts/crowdfunding-esdt/tests/crowdfunding_esdt_blackbox_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_go_test.rs 88.24% 88.24% 88.24% 88.24%
/contracts/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_rs_test.rs 89.83% 88.24% 88.24% 88.24%
/contracts/crypto-bubbles/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-bubbles/src/crypto_bubbles.rs 100.00% 100.00% 100.00% 33.75%
/contracts/crypto-bubbles/tests/crypto_bubbles_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/crypto-bubbles/tests/crypto_bubbles_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/crypto-kitties/common/kitty/src/color.rs 70.37% 25.00% 25.00% 7.69%
/contracts/crypto-kitties/common/kitty/src/kitty.rs 87.93% 58.82% 58.33% 20.59%
/contracts/crypto-kitties/common/kitty/src/kitty_genes.rs 43.75% 14.29% 14.29% 3.85%
/contracts/crypto-kitties/common/random/src/lib.rs 64.71% 53.33% 50.00% 36.36%
/contracts/crypto-kitties/kitty-auction/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-kitties/kitty-auction/src/auction.rs 65.38% 10.00% 10.00% 3.70%
/contracts/crypto-kitties/kitty-auction/src/kitty_ownership_proxy.rs 20.63% 21.74% 21.74% 9.80%
/contracts/crypto-kitties/kitty-auction/src/lib.rs 85.88% 78.87% 80.95% 18.52%
/contracts/crypto-kitties/kitty-auction/tests/kitty_auction_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/crypto-kitties/kitty-auction/tests/kitty_auction_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/crypto-kitties/kitty-genetic-alg/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-kitties/kitty-genetic-alg/src/lib.rs 100.00% 100.00% 100.00% 36.84%
/contracts/crypto-kitties/kitty-genetic-alg/tests/kitty_genetic_alg_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/crypto-kitties/kitty-genetic-alg/tests/kitty_genetic_alg_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/crypto-kitties/kitty-ownership/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-kitties/kitty-ownership/src/kitty_genetic_alg_proxy.rs 69.23% 66.67% 66.67% 28.57%
/contracts/crypto-kitties/kitty-ownership/src/lib.rs 83.95% 75.36% 89.74% 29.93%
/contracts/crypto-kitties/kitty-ownership/tests/kitty_ownership_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/crypto-kitties/kitty-ownership/tests/kitty_ownership_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/crypto-zombies/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-zombies/src/kitty_obj.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-zombies/src/kitty_ownership_proxy.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-zombies/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-zombies/src/proxy_crypto_zombies.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-zombies/src/storage.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-zombies/src/zombie.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-zombies/src/zombie_attack.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-zombies/src/zombie_factory.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-zombies/src/zombie_feeding.rs 0.00% 0.00% 0.00% 0.00%
/contracts/crypto-zombies/src/zombie_helper.rs 0.00% 0.00% 0.00% 0.00%
/contracts/digital-cash/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/digital-cash/src/deposit_info.rs 41.18% 28.57% 9.09% 5.88%
/contracts/digital-cash/src/digital_cash.rs 57.45% 51.72% 85.71% 25.53%
/contracts/digital-cash/src/digital_cash_proxy.rs 0.00% 0.00% 0.00% 0.00%
/contracts/digital-cash/src/helpers.rs 90.12% 88.46% 81.82% 37.50%
/contracts/digital-cash/src/pay_fee_and_fund.rs 97.67% 88.89% 83.33% 26.67%
/contracts/digital-cash/src/signature_operations.rs 94.92% 89.19% 88.89% 31.25%
/contracts/digital-cash/src/storage.rs 50.00% 50.00% 50.00% 20.83%
/contracts/digital-cash/tests/digital_cash_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/digital-cash/tests/digital_cash_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/dn404/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/dn404/src/available_tokens.rs 91.58% 77.50% 57.14% 26.42%
/contracts/dn404/src/dn404_proxy.rs 49.64% 35.29% 35.29% 27.08%
/contracts/dn404/src/fee.rs 62.96% 56.25% 45.45% 20.00%
/contracts/dn404/src/lib.rs 92.31% 75.00% 66.67% 14.29%
/contracts/dn404/src/price.rs 93.33% 87.50% 80.00% 23.08%
/contracts/dn404/tests/dn404_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/dn404/tests/setup.rs 97.50% 80.00% 75.00% 37.50%
/contracts/empty/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/empty/src/empty.rs 100.00% 100.00% 100.00% 17.86%
/contracts/empty/tests/empty_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/empty/tests/empty_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/erc3643/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/erc3643/src/exchange_actions.rs 0.00% 0.00% 0.00% 0.00%
/contracts/erc3643/src/hooks/call_hook.rs 0.00% 0.00% 0.00% 0.00%
/contracts/erc3643/src/hooks/change_hooks.rs 0.00% 0.00% 0.00% 0.00%
/contracts/erc3643/src/hooks/hook_type.rs 0.00% 0.00% 0.00% 0.00%
/contracts/erc3643/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/contracts/erc3643/src/token.rs 0.00% 0.00% 0.00% 0.00%
/contracts/erc3643/src/transfer.rs 0.00% 0.00% 0.00% 0.00%
/contracts/erc3643/src/users.rs 0.00% 0.00% 0.00% 0.00%
/contracts/esdt-transfer-with-fee/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/esdt-transfer-with-fee/src/esdt_transfer_with_fee.rs 97.33% 96.67% 100.00% 27.27%
/contracts/esdt-transfer-with-fee/src/fee.rs 0.00% 0.00% 0.00% 0.00%
/contracts/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/factorial/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/factorial/src/factorial.rs 100.00% 100.00% 100.00% 31.75%
/contracts/factorial/tests/factorial_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/factorial/tests/factorial_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/factorial/tests/factorial_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/fair-launch/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/fair-launch/src/common.rs 73.44% 57.14% 33.33% 16.67%
/contracts/fair-launch/src/exchange_actions.rs 85.34% 78.95% 53.85% 26.83%
/contracts/fair-launch/src/fair_launch_proxy.rs 67.80% 61.11% 61.11% 41.94%
/contracts/fair-launch/src/initial_launch.rs 92.36% 68.00% 53.33% 31.25%
/contracts/fair-launch/src/lib.rs 100.00% 100.00% 100.00% 22.22%
/contracts/fair-launch/src/pair_mock_proxy.rs 53.12% 66.67% 66.67% 40.00%
/contracts/fair-launch/src/token_info.rs 12.00% 28.57% 40.00% 12.00%
/contracts/fair-launch/src/transfer.rs 71.79% 67.65% 62.50% 18.92%
/contracts/fair-launch/tests/fair_launch_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/fair-launch/tests/tests_common.rs 100.00% 100.00% 100.00% 50.00%
/contracts/fractional-nfts/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/fractional-nfts/src/fractional_nfts.rs 0.00% 0.00% 0.00% 0.00%
/contracts/fractional-nfts/src/fractional_uri_info.rs 0.00% 0.00% 0.00% 0.00%
/contracts/fractional-nfts/src/nft_marketplace_proxy.rs 0.00% 0.00% 0.00% 0.00%
/contracts/generic-composable-tasks/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/generic-composable-tasks/src/call_dispatcher.rs 83.19% 70.83% 33.33% 13.95%
/contracts/generic-composable-tasks/src/high_level_calls.rs 68.18% 62.50% 50.00% 16.67%
/contracts/generic-composable-tasks/src/lib.rs 50.00% 50.00% 50.00% 8.33%
/contracts/generic-composable-tasks/src/raw_call/async_call.rs 94.92% 83.33% 83.33% 29.63%
/contracts/generic-composable-tasks/src/raw_call/common.rs 73.53% 47.06% 41.67% 16.67%
/contracts/generic-composable-tasks/src/raw_call/simple_transfer.rs 81.82% 50.00% 50.00% 16.67%
/contracts/generic-composable-tasks/src/raw_call/sync_call.rs 92.00% 50.00% 50.00% 16.67%
/contracts/generic-composable-tasks/src/unique_payments.rs 68.12% 61.54% 50.00% 33.33%
/contracts/generic-composable-tasks/tests/generic_composable_tasks_test_setup/mod.rs 97.96% 84.00% 100.00% 100.00%
/contracts/generic-composable-tasks/tests/generic_composable_tasks_tests.rs 100.00% 100.00% 100.00% 100.00%
/contracts/liquid-locking/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/liquid-locking/src/lib.rs 77.50% 76.92% 70.59% 23.02%
/contracts/liquid-locking/src/liquid_locking_proxy.rs 35.37% 28.57% 28.57% 23.33%
/contracts/liquid-locking/src/unlocked_token.rs 0.00% 0.00% 0.00% 0.00%
/contracts/liquid-locking/tests/liquid_locking_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/lottery-esdt/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/lottery-esdt/src/lottery.rs 92.92% 93.18% 100.00% 31.82%
/contracts/lottery-esdt/src/lottery_info.rs 0.00% 0.00% 0.00% 0.00%
/contracts/lottery-esdt/src/status.rs 0.00% 0.00% 0.00% 0.00%
/contracts/lottery-esdt/tests/lottery_esdt_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/lottery-esdt/tests/lottery_esdt_scenario_rs_test.rs 94.12% 93.55% 93.55% 93.55%
/contracts/multisig/interact/src/multisig_interact.rs 0.00% 0.00% 0.00% 0.00%
/contracts/multisig/interact/src/multisig_interact_cli.rs 0.00% 0.00% 0.00% 0.00%
/contracts/multisig/interact/src/multisig_interact_config.rs 0.00% 0.00% 0.00% 0.00%
/contracts/multisig/interact/src/multisig_interact_nfts.rs 0.00% 0.00% 0.00% 0.00%
/contracts/multisig/interact/src/multisig_interact_state.rs 0.00% 0.00% 0.00% 0.00%
/contracts/multisig/interact/src/multisig_interact_wegld.rs 0.00% 0.00% 0.00% 0.00%
/contracts/multisig/interact/src/wegld_proxy.rs 0.00% 0.00% 0.00% 0.00%
/contracts/multisig/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/multisig/src/action.rs 70.00% 71.88% 50.00% 9.35%
/contracts/multisig/src/multisig.rs 77.08% 77.27% 91.67% 23.12%
/contracts/multisig/src/multisig_events.rs 50.00% 50.00% 50.00% 24.72%
/contracts/multisig/src/multisig_perform.rs 72.26% 67.01% 72.22% 27.37%
/contracts/multisig/src/multisig_propose.rs 75.54% 74.00% 81.25% 22.12%
/contracts/multisig/src/multisig_proxy.rs 46.76% 31.75% 31.75% 15.13%
/contracts/multisig/src/multisig_sign.rs 62.00% 53.45% 54.55% 9.27%
/contracts/multisig/src/multisig_state.rs 93.22% 84.62% 73.33% 23.10%
/contracts/multisig/src/user_role.rs 76.47% 62.50% 71.43% 27.78%
/contracts/multisig/tests/multisig_blackbox_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/multisig/tests/multisig_scenario_go_test.rs 78.95% 78.95% 78.95% 78.95%
/contracts/multisig/tests/multisig_scenario_rs_test.rs 77.50% 68.42% 68.42% 68.42%
/contracts/multisig/tests/multisig_whitebox_test.rs 99.87% 99.32% 100.00% 100.00%
/contracts/mvx-game-sc/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/mvx-game-sc/src/game_proxy.rs 54.88% 34.38% 34.38% 26.53%
/contracts/mvx-game-sc/src/lib.rs 93.62% 78.57% 100.00% 29.27%
/contracts/mvx-game-sc/src/owner.rs 72.00% 56.25% 33.33% 8.33%
/contracts/mvx-game-sc/src/private.rs 91.60% 85.71% 80.00% 37.50%
/contracts/mvx-game-sc/src/storage.rs 25.00% 33.33% 33.33% 19.70%
/contracts/mvx-game-sc/src/types.rs 0.00% 0.00% 0.00% 0.00%
/contracts/mvx-game-sc/tests/game_sc_blackbox_tests.rs 96.15% 92.86% 100.00% 100.00%
/contracts/mystery-box/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/mystery-box/src/config.rs 72.50% 26.67% 26.67% 9.43%
/contracts/mystery-box/src/events.rs 83.33% 75.00% 75.00% 13.79%
/contracts/mystery-box/src/lib.rs 99.11% 95.83% 87.50% 15.48%
/contracts/mystery-box/src/mystery_box_proxy.rs 30.87% 20.00% 20.00% 8.47%
/contracts/mystery-box/src/rewards.rs 84.00% 80.00% 60.00% 15.00%
/contracts/mystery-box/src/token_attributes.rs 94.44% 71.43% 50.00% 10.00%
/contracts/mystery-box/tests/mystery_box_mod.rs 98.10% 88.89% 85.71% 42.86%
/contracts/mystery-box/tests/mystery_box_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/nft-escrow/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/nft-escrow/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/contracts/nft-escrow/tests/nft_escrow_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/nft-escrow/tests/nft_escrow_scenario_rs_test.rs 0.00% 0.00% 0.00% 0.00%
/contracts/nft-minter/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/nft-minter/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/contracts/nft-minter/src/nft_marketplace_proxy.rs 0.00% 0.00% 0.00% 0.00%
/contracts/nft-minter/src/nft_module.rs 0.00% 0.00% 0.00% 0.00%
/contracts/nft-minter/tests/nft_minter_scenario_rs_test.rs 0.00% 0.00% 0.00% 0.00%
/contracts/nft-minter/tests/scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/nft-storage-prepay/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/nft-storage-prepay/src/nft_storage_prepay.rs 0.00% 0.00% 0.00% 0.00%
/contracts/on-chain-claim/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/on-chain-claim/src/address_info.rs 80.77% 28.57% 28.57% 11.11%
/contracts/on-chain-claim/src/config.rs 69.70% 61.54% 66.67% 8.20%
/contracts/on-chain-claim/src/contract.rs 80.33% 80.65% 60.00% 6.93%
/contracts/on-chain-claim/src/events.rs 50.00% 50.00% 50.00% 10.34%
/contracts/on-chain-claim/tests/tests.rs 100.00% 100.00% 100.00% 100.00%
/contracts/order-book/factory/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/order-book/factory/src/lib.rs 0.00% 0.00% 0.00% 0.00%
/contracts/order-book/pair/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/order-book/pair/src/common.rs 44.83% 28.57% 25.00% 10.24%
/contracts/order-book/pair/src/events.rs 97.22% 93.33% 83.33% 19.51%
/contracts/order-book/pair/src/global.rs 33.33% 33.33% 33.33% 4.35%
/contracts/order-book/pair/src/lib.rs 100.00% 100.00% 100.00% 18.00%
/contracts/order-book/pair/src/orders.rs 98.59% 88.78% 95.00% 24.21%
/contracts/order-book/pair/src/validation.rs 88.00% 79.55% 86.67% 26.00%
/contracts/order-book/pair/tests/pair_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/order-book/pair/tests/pair_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/pair-mock/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/pair-mock/src/pair_mock.rs 95.45% 88.89% 75.00% 25.64%
/contracts/paymaster/interactor/src/interactor_main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/paymaster/interactor/src/paymaster_config.rs 0.00% 0.00% 0.00% 0.00%
/contracts/paymaster/interactor/src/proxy.rs 0.00% 0.00% 0.00% 0.00%
/contracts/paymaster/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/paymaster/src/forward_call.rs 82.00% 76.92% 80.00% 20.69%
/contracts/paymaster/src/paymaster.rs 100.00% 100.00% 100.00% 14.04%
/contracts/paymaster/src/paymaster_proxy.rs 80.95% 75.00% 75.00% 42.86%
/contracts/paymaster/tests/paymaster_blackbox_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/ping-pong-egld/interactor/src/interact.rs 0.00% 0.00% 0.00% 0.00%
/contracts/ping-pong-egld/interactor/src/interact_cli.rs 0.00% 0.00% 0.00% 0.00%
/contracts/ping-pong-egld/interactor/src/interact_config.rs 0.00% 0.00% 0.00% 0.00%
/contracts/ping-pong-egld/interactor/src/interact_main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/ping-pong-egld/interactor/src/interact_state.rs 0.00% 0.00% 0.00% 0.00%
/contracts/ping-pong-egld/interactor/src/proxy_ping_pong_egld.rs 0.00% 0.00% 0.00% 0.00%
/contracts/ping-pong-egld/interactor/tests/interact_cs_test.rs 0.00% 0.00% 0.00% 0.00%
/contracts/ping-pong-egld/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/ping-pong-egld/src/ping_pong.rs 75.65% 80.95% 72.73% 22.73%
/contracts/ping-pong-egld/src/types.rs 0.00% 0.00% 0.00% 0.00%
/contracts/ping-pong-egld/tests/ping_pong_egld_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/ping-pong-egld/tests/ping_pong_egld_scenario_rs_test.rs 90.16% 88.89% 88.89% 88.89%
/contracts/potlock/interact-rs/src/potlock_interactor_main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/potlock/interact-rs/src/proxy.rs 0.00% 0.00% 0.00% 0.00%
/contracts/potlock/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/potlock/src/potlock.rs 100.00% 100.00% 100.00% 22.22%
/contracts/potlock/src/potlock_admin_interactions.rs 72.29% 72.73% 66.67% 20.83%
/contracts/potlock/src/potlock_interactions.rs 90.14% 75.00% 83.33% 26.67%
/contracts/potlock/src/potlock_requirements.rs 94.12% 89.47% 81.82% 37.50%
/contracts/potlock/src/potlock_storage.rs 60.78% 13.04% 13.04% 12.99%
/contracts/potlock/tests/potlock_blackbox_tests.rs 100.00% 97.73% 100.00% 100.00%
/contracts/potlock/tests/potlock_proxy.rs 53.93% 38.24% 38.24% 21.43%
/contracts/price-aggregator/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/price-aggregator/src/events.rs 83.87% 37.50% 37.50% 26.79%
/contracts/price-aggregator/src/lib.rs 74.55% 58.49% 62.96% 32.37%
/contracts/price-aggregator/src/median.rs 81.25% 53.33% 100.00% 75.00%
/contracts/price-aggregator/src/price_aggregator_data.rs 0.00% 0.00% 0.00% 0.00%
/contracts/price-aggregator/tests/price_aggregator_blackbox_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/price-aggregator/tests/price_aggregator_proxy.rs 40.61% 30.00% 30.00% 21.88%
/contracts/price-aggregator/tests/price_aggregator_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/price-aggregator/tests/price_aggregator_stress_blackbox.rs 100.00% 100.00% 100.00% 100.00%
/contracts/price-aggregator/tests/price_aggregator_whitebox_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/proxy-deployer/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/proxy-deployer/src/config.rs 31.25% 16.67% 20.00% 11.11%
/contracts/proxy-deployer/src/contract_interactions.rs 65.22% 52.86% 72.73% 22.92%
/contracts/proxy-deployer/src/events.rs 43.55% 21.43% 21.43% 10.53%
/contracts/proxy-deployer/src/lib.rs 100.00% 100.00% 100.00% 22.22%
/contracts/proxy-deployer/src/proxy_deployer_proxy.rs 30.69% 17.95% 17.95% 17.02%
/contracts/proxy-deployer/tests/proxy_deployer_blackbox_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/proxy-pause/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/proxy-pause/src/pause_sc_proxy.rs 100.00% 100.00% 100.00% 50.00%
/contracts/proxy-pause/src/proxy_pause.rs 75.00% 83.33% 76.92% 25.30%
/contracts/proxy-pause/tests/proxy_pause_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/proxy-pause/tests/proxy_pause_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/rewards-distribution/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/rewards-distribution/src/rewards_distribution.rs 90.66% 84.54% 76.32% 13.55%
/contracts/rewards-distribution/src/seed_nft_minter_proxy.rs 14.29% 20.00% 20.00% 9.52%
/contracts/rewards-distribution/tests/compute_brackets_whitebox_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/rewards-distribution/tests/mock_seed_nft_minter.rs 83.33% 75.00% 75.00% 15.15%
/contracts/rewards-distribution/tests/test_raffle_and_claim_legacy_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/rewards-distribution/tests/utils.rs 100.00% 100.00% 100.00% 66.67%
/contracts/seed-nft-minter/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/seed-nft-minter/src/distribution_module.rs 0.00% 0.00% 0.00% 0.00%
/contracts/seed-nft-minter/src/nft_marketplace_proxy.rs 0.00% 0.00% 0.00% 0.00%
/contracts/seed-nft-minter/src/nft_module.rs 0.00% 0.00% 0.00% 0.00%
/contracts/seed-nft-minter/src/seed_nft_minter.rs 0.00% 0.00% 0.00% 0.00%
/contracts/token-release/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/token-release/src/contract_data.rs 0.00% 0.00% 0.00% 0.00%
/contracts/token-release/src/token_release.rs 66.53% 56.41% 73.08% 26.06%
/contracts/token-release/tests/token_release_scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/token-release/tests/token_release_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/wegld-swap/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/contracts/wegld-swap/src/wegld.rs 100.00% 100.00% 100.00% 34.21%
/contracts/wegld-swap/src/wegld_proxy.rs 33.33% 33.33% 33.33% 30.77%
/contracts/wegld-swap/tests/scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/contracts/wegld-swap/tests/wegld_swap_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%

);
let caller = self.blockchain().get_caller();

let potlock_id = self.potlocks().len() + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is a good idea, as you also have a way to remove data from this storage (removePot endpoint) - which means it may overwrite already existing ids. So it will be better if you keep a separate storage for the lastId and increment that value each time a new pot is created.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing the second element from a VecMapper that contains 4 elements (1, 2, 3, 4), we would get 1, 3, 4.
Removing the last element from a VecMapper that contains 4 elements (1, 2, 3, 4), we would get 1, 2, 3. By adding another element, we would get 1, 2, 3, 5.
There is no need for the lastId.

let caller = self.blockchain().get_caller();
self.require_potlock_exists(potlock_id);
self.require_potlock_is_active(potlock_id);
self.pot_donations(potlock_id).insert(caller, payment);
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a problem here if I donate twice. The old donation would be overwritten and I'll remain with that amount in the contract unregistered. There are a few ways around this:

  1. You take the output of the insert function and send back to the user
  2. You add a check if there is already a donation on behalf of that user.
  3. Instead of a EsdtTokenPayment per user, you save a PaymentsVec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accepted multiple payments but only with the same token_id.

Copy link
Contributor

Choose a reason for hiding this comment

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

This function is still the same. The payment token is not checked. And in case you only ask for a specific payment token, you would still need a check, to see if there is already some donation from the caller. If it isn't, then you add it, if there's already something, you accumulate it. But this works only if the accepted token_id is always the same and not changeable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now I see you did this update for the donateToProject endpoint, but it is needed here also.

for pp in project_percentage {
let (project_id, percentage) = pp.into_tuple();
let mut output_payments = ManagedVec::new();
for (_, donation) in pot_donations.iter() {
Copy link
Contributor

Choose a reason for hiding this comment

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

There may be a few problems with this way of implementing (as Dorin also suggested), mostly concerning gas usage. If a malicious user donates values from 1000 addresses, the potlock will be blocked, with an outOfGas error.
Maybe rethink the architecture of the storages. One option would be instead of a mapMapper, to save under the potlock_id and user keys, a singleValueMapper of PaymentsVec. This allows you to quickly go to a specific user for donations and also, this endpoint would control the gasCost by clearly providing a list of users, besides the potlockId.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are unable to iterated through all payments and distribute them if we have singleValueMapper.


#[view(getProjects)]
#[storage_mapper("projects")]
fn projects(&self) -> VecMapper<Project<Self::Api>>;
Copy link
Contributor

Choose a reason for hiding this comment

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

UnorderedSetMapper here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would get a different behavior as explained to potlocks.

@CostinCarabas CostinCarabas self-assigned this Oct 13, 2024
#[payable("*")]
#[endpoint(addPot)]
fn add_pot(&self, name: ManagedBuffer, description: ManagedBuffer) {
let payment_for_adding_pot = self.call_value().single_esdt();
Copy link
Contributor

Choose a reason for hiding this comment

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

Not mandatory, but you could add these 2 storages under a single one, that keeps a EsdtTokenPayment struct. And you can check here if the payments are equal.


#[only_admin]
#[endpoint(distributePotToProjects)]
fn distribute_pot_to_projects(
Copy link
Contributor

Choose a reason for hiding this comment

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

A few more questions here. Not mandatory but are good to be discussed.

  • Right now, there is no way to be sure all the projects that applied for this pot were covered in the provided array, is it ok for the owner to be able to give the amounts arbitrary and to not all projects?
  • Also, there is no check that the project applied to this specific pot, maybe add a check after you read each project from storage, that the project is active for this pot? If not, why even bother to approve a project for a pot?
  • And finally, how about a limit to the number of projects that can apply for a pot? Either here for the number of elements for project_percentages, or for when subscribing a project to a pot.

let (_, perc) = pp.into_tuple();
total_perc += perc;
}
require!(
Copy link
Contributor

Choose a reason for hiding this comment

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

I would still enforce clear equality here.
total_perc == MAX_PERCENTAGE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll keep it like this for now in case we want to distribute part of the pot.

Copy link

github-actions bot commented Apr 17, 2025

Contract comparison - from d451bc5 to 8733f5f

Path                                                                                             size                  has-allocator                     has-format
liquid-locking.wasm 8895 false None
bonding-curve-contract.wasm 14329 false None
order-book-pair.wasm 14201 false None
order-book-factory.wasm 3491 false None
mystery-box.wasm 12867 false None
crowdfunding-esdt.wasm 3966 false None
fractional-nfts.wasm 8337 false without message
ping-pong-egld.wasm 6517 false None
erc3643.wasm 9459 false without message
fair-launch.wasm 21836 false without message
factorial.wasm 576 false None
generic-composable-tasks.wasm 11972 false None
crypto-bubbles.wasm 2678 false None
lottery-esdt.wasm 11046 false without message
proxy-pause.wasm 4299 false None
dn404.wasm 13259 false without message
esdt-transfer-with-fee.wasm 7722 false without message
nft-escrow.wasm 7048 false None
seed-nft-minter.wasm 14799 false without message
multiversx-price-aggregator-sc.wasm 18441 false without message
check-pause.wasm 1396 false None
paymaster.wasm 8005 false without message
nft-storage-prepay.wasm 2728 false None
rewards-distribution.wasm 9929 false without message
proxy-deployer.wasm 11365 false without message
crypto-zombies.wasm 9683 false without message
on-chain-claim.wasm 7064 false None
kitty-genetic-alg.wasm 3463 false without message
kitty-ownership.wasm 13208 false without message
kitty-auction.wasm 9693 false without message
digital-cash.wasm 9893 false None
adder.wasm 696 false None
mvx-game-sc.wasm 10269 false None
empty.wasm 241 false None
nft-minter.wasm 9759 false without message
token-release.wasm 7542 false without message
multiversx-wegld-swap-sc.wasm 4555 false None
pair-mock.wasm 2363 false None
multisig-view.wasm 8692 false None
multisig-full.wasm 25651 false without message
multisig.wasm 23527 false without message

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.

6 participants