├── .github └── workflows │ ├── actions.yml │ ├── on_pull_request_build_contracts.yml │ └── release.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── contracts ├── adder │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── interaction │ │ ├── devnet.snippets.sh │ │ └── testnet.snippets.sh │ ├── interactor │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── config.toml │ │ ├── src │ │ │ ├── basic_interactor.rs │ │ │ ├── basic_interactor_cli.rs │ │ │ ├── basic_interactor_config.rs │ │ │ ├── basic_interactor_main.rs │ │ │ └── basic_interactor_state.rs │ │ └── tests │ │ │ └── basic_interactor_cs_test.rs │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── mxsc-template.toml │ ├── sc-config.toml │ ├── scenarios │ │ ├── adder.scen.json │ │ └── interactor_trace.scen.json │ ├── src │ │ ├── adder.rs │ │ └── adder_proxy.rs │ ├── tests │ │ ├── adder_blackbox_test.rs │ │ ├── adder_scenario_go_test.rs │ │ ├── adder_scenario_rs_test.rs │ │ ├── adder_unit_test.rs │ │ └── adder_whitebox_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── bonding-curve-contract │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── docs │ │ ├── linear.md │ │ └── selector.md │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── scenarios │ │ ├── buy.scen.json │ │ ├── claim.scen.json │ │ ├── deploy.scen.json │ │ ├── deposit.scen.json │ │ ├── deposit_more_view.scen.json │ │ ├── sell.scen.json │ │ └── set_bonding_curve.scen.json │ ├── src │ │ ├── bonding_curve_contract.rs │ │ └── function_selector.rs │ ├── tests │ │ ├── bonding_curve_scenario_go_test.rs │ │ └── bonding_curve_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── check-pause │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── src │ │ └── check_pause.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── crowdfunding-esdt │ ├── .gitignore │ ├── Cargo.toml │ ├── interaction │ │ ├── alice.pem │ │ ├── devnet.snippets.sh │ │ └── testnet.snippets.sh │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── scenarios │ │ ├── _generated_fund.scen.json │ │ ├── _generated_init.scen.json │ │ ├── _generated_query_status.scen.json │ │ ├── _generated_sc_err.scen.json │ │ ├── crowdfunding-claim-failed.scen.json │ │ ├── crowdfunding-claim-successful.scen.json │ │ ├── crowdfunding-claim-too-early.scen.json │ │ ├── crowdfunding-fund-too-late.scen.json │ │ ├── crowdfunding-fund.scen.json │ │ ├── crowdfunding-init.scen.json │ │ ├── egld-crowdfunding-claim-failed.scen.json │ │ ├── egld-crowdfunding-claim-successful.scen.json │ │ ├── egld-crowdfunding-claim-too-early.scen.json │ │ ├── egld-crowdfunding-fund-too-late.scen.json │ │ ├── egld-crowdfunding-fund.scen.json │ │ └── egld-crowdfunding-init.scen.json │ ├── src │ │ ├── crowdfunding_esdt.rs │ │ └── crowdfunding_esdt_proxy.rs │ ├── tests │ │ ├── crowdfunding_esdt_blackbox_test.rs │ │ ├── crowdfunding_esdt_scenario_go_test.rs │ │ └── crowdfunding_esdt_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── crypto-bubbles │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── scenarios │ │ ├── balanceOf.scen.json │ │ ├── create.scen.json │ │ ├── exceptions.scen.json │ │ ├── joinGame.scen.json │ │ ├── rewardAndSendToWallet.scen.json │ │ ├── rewardWinner.scen.json │ │ ├── rewardWinner_Last.scen.json │ │ ├── topUp_ok.scen.json │ │ ├── topUp_withdraw.scen.json │ │ ├── withdraw_Ok.scen.json │ │ └── withdraw_TooMuch.scen.json │ ├── src │ │ └── crypto_bubbles.rs │ ├── tests │ │ ├── crypto_bubbles_scenario_go_test.rs │ │ └── crypto_bubbles_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── crypto-kitties │ ├── common │ │ ├── kitty │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ ├── color.rs │ │ │ │ ├── kitty.rs │ │ │ │ ├── kitty_genes.rs │ │ │ │ └── lib.rs │ │ └── random │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ └── lib.rs │ ├── documentation.md │ ├── kitty-auction │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── meta │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── multiversx.json │ │ ├── scenarios │ │ │ ├── bid_first.scen.json │ │ │ ├── bid_second_max.scen.json │ │ │ ├── bid_second_ok.scen.json │ │ │ ├── bid_second_too_low.scen.json │ │ │ ├── bid_siring_auction.scen.json │ │ │ ├── create_and_auction_gen_zero_kitty.scen.json │ │ │ ├── create_sale_auction_not_owner.scen.json │ │ │ ├── create_sale_auction_ok.scen.json │ │ │ ├── create_siring_auction_not_owner.scen.json │ │ │ ├── create_siring_auction_ok.scen.json │ │ │ ├── end_auction_no_bids.scen.json │ │ │ ├── end_auction_second_bid_max_early.scen.json │ │ │ ├── end_auction_second_bid_ok_early.scen.json │ │ │ ├── end_auction_second_bid_ok_late.scen.json │ │ │ ├── end_siring_auction.scen.json │ │ │ └── init.scen.json │ │ ├── src │ │ │ ├── auction.rs │ │ │ ├── kitty_ownership_proxy.rs │ │ │ └── lib.rs │ │ ├── tests │ │ │ ├── kitty_auction_scenario_go_test.rs │ │ │ └── kitty_auction_scenario_rs_test.rs │ │ └── wasm │ │ │ ├── Cargo.lock │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ └── lib.rs │ ├── kitty-genetic-alg │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── meta │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── multiversx.json │ │ ├── sc-config.toml │ │ ├── scenarios │ │ │ ├── generate-kitty-genes.scen.json │ │ │ └── init.scen.json │ │ ├── src │ │ │ └── lib.rs │ │ ├── tests │ │ │ ├── kitty_genetic_alg_scenario_go_test.rs │ │ │ └── kitty_genetic_alg_scenario_rs_test.rs │ │ └── wasm │ │ │ ├── Cargo.lock │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ └── lib.rs │ └── kitty-ownership │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ │ ├── multiversx.json │ │ ├── sc-config.toml │ │ ├── scenarios │ │ ├── approve_siring.scen.json │ │ ├── breed_ok.scen.json │ │ ├── give_birth.scen.json │ │ ├── init.scen.json │ │ ├── query.scen.json │ │ └── setup_accounts.scen.json │ │ ├── src │ │ ├── kitty_genetic_alg_proxy.rs │ │ └── lib.rs │ │ ├── tests │ │ ├── kitty_ownership_scenario_go_test.rs │ │ └── kitty_ownership_scenario_rs_test.rs │ │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── crypto-zombies │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── mxsc-template.toml │ ├── sc-config.toml │ ├── src │ │ ├── kitty_obj.rs │ │ ├── kitty_ownership_proxy.rs │ │ ├── lib.rs │ │ ├── proxy_crypto_zombies.rs │ │ ├── storage.rs │ │ ├── zombie.rs │ │ ├── zombie_attack.rs │ │ ├── zombie_factory.rs │ │ ├── zombie_feeding.rs │ │ └── zombie_helper.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── digital-cash │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── scenarios │ │ ├── claim-egld.scen.json │ │ ├── claim-esdt.scen.json │ │ ├── claim-fees.scen.json │ │ ├── claim-multi-esdt.scen.json │ │ ├── forward.scen.json │ │ ├── fund-egld-and-esdt.scen.json │ │ ├── pay-fee-and-fund-egld.scen.json │ │ ├── pay-fee-and-fund-esdt.scen.json │ │ ├── set-accounts.scen.json │ │ ├── whitelist-blacklist-fee-tokens.scen.json │ │ ├── withdraw-egld.scen.json │ │ ├── withdraw-esdt.scen.json │ │ └── withdraw-multi-esdt.scen.json │ ├── src │ │ ├── constants.rs │ │ ├── deposit_info.rs │ │ ├── digital_cash.rs │ │ ├── digital_cash_proxy.rs │ │ ├── helpers.rs │ │ ├── pay_fee_and_fund.rs │ │ ├── signature_operations.rs │ │ └── storage.rs │ ├── tests │ │ ├── digital_cash_scenario_go_test.rs │ │ └── digital_cash_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── dn404 │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── src │ │ ├── available_tokens.rs │ │ ├── dn404_proxy.rs │ │ ├── fee.rs │ │ ├── lib.rs │ │ └── price.rs │ ├── tests │ │ ├── dn404_test.rs │ │ └── setup.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── empty │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── mxsc-template.toml │ ├── scenarios │ │ └── empty.scen.json │ ├── src │ │ └── empty.rs │ ├── tests │ │ ├── empty_scenario_go_test.rs │ │ └── empty_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── erc3643 │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── src │ │ ├── exchange_actions.rs │ │ ├── hooks │ │ │ ├── call_hook.rs │ │ │ ├── change_hooks.rs │ │ │ ├── hook_type.rs │ │ │ └── mod.rs │ │ ├── lib.rs │ │ ├── token.rs │ │ ├── transfer.rs │ │ └── users.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── esdt-transfer-with-fee │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── scenarios │ │ ├── claim.scen.json │ │ ├── deploy.scen.json │ │ └── setup_fees_and_transfer.scen.json │ ├── src │ │ ├── esdt_transfer_with_fee.rs │ │ └── fee.rs │ ├── tests │ │ ├── esdt_transfer_with_fee_scenario_go_test.rs │ │ └── esdt_transfer_with_fee_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── factorial │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── scenarios │ │ └── factorial.scen.json │ ├── src │ │ └── factorial.rs │ ├── tests │ │ ├── factorial_scenario_go_test.rs │ │ ├── factorial_scenario_rs_test.rs │ │ └── factorial_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── fair-launch │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── readme.md │ ├── sc-config.toml │ ├── src │ │ ├── common.rs │ │ ├── exchange_actions.rs │ │ ├── fair_launch_proxy.rs │ │ ├── initial_launch.rs │ │ ├── lib.rs │ │ ├── pair_mock_proxy.rs │ │ ├── token_info.rs │ │ └── transfer.rs │ ├── tests │ │ ├── fair_launch_test.rs │ │ └── tests_common.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── fractional-nfts │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── readme.md │ ├── src │ │ ├── fractional_nfts.rs │ │ ├── fractional_uri_info.rs │ │ └── nft_marketplace_proxy.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── generic-composable-tasks │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── src │ │ ├── call_dispatcher.rs │ │ ├── high_level_calls.rs │ │ ├── lib.rs │ │ ├── raw_call │ │ │ ├── async_call.rs │ │ │ ├── common.rs │ │ │ ├── mod.rs │ │ │ ├── simple_transfer.rs │ │ │ └── sync_call.rs │ │ └── unique_payments.rs │ ├── tests │ │ ├── generic_composable_tasks_test_setup │ │ │ └── mod.rs │ │ └── generic_composable_tasks_tests.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── liquid-locking │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── scenarios │ │ └── empty.scen.json │ ├── src │ │ ├── lib.rs │ │ ├── liquid_locking_proxy.rs │ │ └── unlocked_token.rs │ ├── tests │ │ └── liquid_locking_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── lottery-esdt │ ├── .gitignore │ ├── Cargo.toml │ ├── documentation.md │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── scenarios │ │ ├── buy-all-tickets-different-accounts.scen.json │ │ ├── buy-more-tickets-than-allowed.scen.json │ │ ├── buy-ticket-after-deadline.scen.json │ │ ├── buy-ticket-after-determined-winner.scen.json │ │ ├── buy-ticket-after-sold-out.scen.json │ │ ├── buy-ticket-all-options.scen.json │ │ ├── buy-ticket-another-account.scen.json │ │ ├── buy-ticket-not-on-whitelist.scen.json │ │ ├── buy-ticket-same-account.scen.json │ │ ├── buy-ticket-second-lottery.scen.json │ │ ├── buy-ticket-wrong-fee.scen.json │ │ ├── buy-ticket.scen.json │ │ ├── complex-prize-distribution.scen.json │ │ ├── determine-winner-different-ticket-holders-winner-acc1.scen.json │ │ ├── determine-winner-early.scen.json │ │ ├── determine-winner-same-ticket-holder.scen.json │ │ ├── determine-winner-split-prize-pool.scen.json │ │ ├── lottery-init.scen.json │ │ ├── lottery-with-burn-percentage.scen.json │ │ ├── start-after-announced-winner.scen.json │ │ ├── start-all-options-bigger-whitelist.scen.json │ │ ├── start-alternative-function-name.scen.json │ │ ├── start-fixed-deadline.scen.json │ │ ├── start-limited-tickets-and-fixed-deadline-invalid-deadline.scen.json │ │ ├── start-limited-tickets-and-fixed-deadline-invalid-ticket-price-arg.scen.json │ │ ├── start-limited-tickets-and-fixed-deadline.scen.json │ │ ├── start-limited-tickets.scen.json │ │ ├── start-second-lottery.scen.json │ │ ├── start-with-all-options.scen.json │ │ └── start-with-no-options.scen.json │ ├── src │ │ ├── lottery.rs │ │ ├── lottery_info.rs │ │ └── status.rs │ ├── tests │ │ ├── lottery_esdt_scenario_go_test.rs │ │ └── lottery_esdt_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── multisig │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── interact │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── config.toml │ │ └── src │ │ │ ├── multisig_interact.rs │ │ │ ├── multisig_interact_cli.rs │ │ │ ├── multisig_interact_config.rs │ │ │ ├── multisig_interact_nfts.rs │ │ │ ├── multisig_interact_state.rs │ │ │ ├── multisig_interact_wegld.rs │ │ │ └── wegld_proxy.rs │ ├── mandos-unsupported │ │ └── call_other_shard-insufficient-gas.scen.json │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── scenarios │ │ ├── call_other_shard-1.scen.json │ │ ├── call_other_shard-2.scen.json │ │ ├── changeBoard.scen.json │ │ ├── changeQuorum.scen.json │ │ ├── changeQuorum_tooBig.scen.json │ │ ├── deployAdder_err.scen.json │ │ ├── deployAdder_then_call.scen.json │ │ ├── deployFactorial.scen.json │ │ ├── deployOtherMultisig.scen.json │ │ ├── deploy_duplicate_bm.scen.json │ │ ├── interactor_nft.scen.json │ │ ├── interactor_nft_all_roles.scen.json │ │ ├── interactor_wegld.scen.json │ │ ├── remove_everyone.scen.json │ │ ├── sendEsdt.scen.json │ │ ├── steps │ │ │ ├── add_bm.steps.json │ │ │ ├── add_prop.steps.json │ │ │ ├── deploy.steps.json │ │ │ ├── deploy_minimal.steps.json │ │ │ ├── init_accounts.steps.json │ │ │ ├── rem_alice.steps.json │ │ │ ├── rem_unknown.steps.json │ │ │ └── sign_unsign_bad_action.steps.json │ │ ├── transfer_no_gas_specified_test.scen.json │ │ ├── upgrade.scen.json │ │ └── upgrade_from_source.scen.json │ ├── src │ │ ├── action.rs │ │ ├── multisig.rs │ │ ├── multisig_events.rs │ │ ├── multisig_perform.rs │ │ ├── multisig_propose.rs │ │ ├── multisig_proxy.rs │ │ ├── multisig_sign.rs │ │ ├── multisig_state.rs │ │ └── user_role.rs │ ├── test-contracts │ │ ├── adder.mxsc.json │ │ ├── adder.wasm │ │ ├── factorial.mxsc.json │ │ └── factorial.wasm │ ├── tests │ │ ├── multisig_blackbox_test.rs │ │ ├── multisig_scenario_go_test.rs │ │ ├── multisig_scenario_rs_test.rs │ │ └── multisig_whitebox_test.rs │ ├── wasm-multisig-full │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── wasm-multisig-view │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── wasm-multisig │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── mvx-game-sc │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── src │ │ ├── game_proxy.rs │ │ ├── lib.rs │ │ ├── owner.rs │ │ ├── private.rs │ │ ├── storage.rs │ │ └── types.rs │ ├── tests │ │ └── game_sc_blackbox_tests.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── mystery-box │ ├── .gitignore │ ├── Cargo.toml │ ├── interaction │ │ └── devnet.snippets.sh │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── src │ │ ├── config.rs │ │ ├── events.rs │ │ ├── lib.rs │ │ ├── mystery_box_proxy.rs │ │ ├── rewards.rs │ │ └── token_attributes.rs │ ├── testnet.toml │ ├── tests │ │ ├── mystery_box_mod.rs │ │ └── mystery_box_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── nft-escrow │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── mxsc-template.toml │ ├── scenarios │ │ ├── accept.scen.json │ │ ├── cancel.scen.json │ │ ├── escrow.scen.json │ │ ├── init.scen.json │ │ └── views.scen.json │ ├── src │ │ └── lib.rs │ ├── tests │ │ ├── nft_escrow_scenario_go_test.rs │ │ └── nft_escrow_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── nft-minter │ ├── .gitignore │ ├── Cargo.toml │ ├── interaction │ │ └── snippets.sh │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── readme.md │ ├── scenarios │ │ ├── buy_nft.scen.json │ │ ├── create_nft.scen.json │ │ └── init.scen.json │ ├── src │ │ ├── lib.rs │ │ ├── nft_marketplace_proxy.rs │ │ └── nft_module.rs │ ├── tests │ │ ├── nft_minter_scenario_rs_test.rs │ │ └── scenario_go_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── nft-storage-prepay │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── src │ │ └── nft_storage_prepay.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── on-chain-claim │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── interaction │ │ ├── devnet.snippets.sh │ │ ├── mainnet.snippets.sh │ │ └── testnet.snippets.sh │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── mxsc-template.toml │ ├── src │ │ ├── address_info.rs │ │ ├── config.rs │ │ ├── contract.rs │ │ └── events.rs │ ├── tests │ │ └── tests.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── order-book │ ├── .gitignore │ ├── factory │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── meta │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── multiversx.json │ │ ├── src │ │ │ └── lib.rs │ │ └── wasm │ │ │ ├── Cargo.lock │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ └── lib.rs │ └── pair │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ │ ├── multiversx.json │ │ ├── scenarios │ │ ├── cancel_all_orders.scen.json │ │ ├── cancel_orders.scen.json │ │ ├── create_buy_order_check.scen.json │ │ ├── create_sell_order_check.scen.json │ │ ├── free_orders.scen.json │ │ ├── match_orders.scen.json │ │ └── steps │ │ │ ├── complete_setup.steps.json │ │ │ ├── create_buy_order.steps.json │ │ │ ├── create_sell_order.steps.json │ │ │ ├── deploy.steps.json │ │ │ └── init_accounts.steps.json │ │ ├── src │ │ ├── common.rs │ │ ├── events.rs │ │ ├── global.rs │ │ ├── lib.rs │ │ ├── orders.rs │ │ └── validation.rs │ │ ├── tests │ │ ├── pair_scenario_go_test.rs │ │ └── pair_scenario_rs_test.rs │ │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── pair-mock │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── src │ │ └── pair_mock.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── paymaster │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── interactor │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── config.toml │ │ ├── src │ │ │ ├── interactor_main.rs │ │ │ ├── paymaster_config.rs │ │ │ └── proxy.rs │ │ └── state.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── scenarios │ │ └── empty.scen.json │ ├── src │ │ ├── forward_call.rs │ │ ├── paymaster.rs │ │ └── paymaster_proxy.rs │ ├── tests │ │ └── paymaster_blackbox_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── ping-pong-egld │ ├── .gitignore │ ├── Cargo.toml │ ├── deploy.json │ ├── interaction │ │ └── snippets.sh │ ├── interactor │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── config.toml │ │ ├── src │ │ │ ├── interact.rs │ │ │ ├── interact_cli.rs │ │ │ ├── interact_config.rs │ │ │ ├── interact_main.rs │ │ │ ├── interact_state.rs │ │ │ └── proxy_ping_pong_egld.rs │ │ └── tests │ │ │ └── interact_cs_test.rs │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── scenarios │ │ ├── ping-pong-call-get-user-addresses.scen.json │ │ ├── ping-pong-call-ping-after-deadline.scen.json │ │ ├── ping-pong-call-ping-before-activation.scen.json │ │ ├── ping-pong-call-ping-before-beginning.scen.json │ │ ├── ping-pong-call-ping-second-user.scen.json │ │ ├── ping-pong-call-ping-twice.scen.json │ │ ├── ping-pong-call-ping-wrong-ammount.scen.json │ │ ├── ping-pong-call-ping.scen.json │ │ ├── ping-pong-call-pong-all-after-pong.scen.json │ │ ├── ping-pong-call-pong-all-interrupted-1.scen.json │ │ ├── ping-pong-call-pong-all-interrupted-2.scen.json │ │ ├── ping-pong-call-pong-all.scen.json │ │ ├── ping-pong-call-pong-all.steps.json │ │ ├── ping-pong-call-pong-before-deadline.scen.json │ │ ├── ping-pong-call-pong-twice.scen.json │ │ ├── ping-pong-call-pong-without-ping.scen.json │ │ ├── ping-pong-call-pong.scen.json │ │ └── ping-pong-init.scen.json │ ├── src │ │ ├── ping_pong.rs │ │ └── types.rs │ ├── tests │ │ ├── ping_pong_egld_scenario_go_test.rs │ │ └── ping_pong_egld_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── price-aggregator │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── scenarios │ │ ├── stress_submit_test.scen.json │ │ └── stress_submit_with_gas_schedule_test.scen.json │ ├── src │ │ ├── events.rs │ │ ├── lib.rs │ │ ├── median.rs │ │ ├── price_aggregator_data.rs │ │ └── staking.rs │ ├── tests │ │ ├── price_aggregator_blackbox_test.rs │ │ ├── price_aggregator_proxy.rs │ │ ├── price_aggregator_scenario_go_test.rs │ │ ├── price_aggregator_stress_blackbox.rs │ │ └── price_aggregator_whitebox_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── proxy-deployer │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── src │ │ ├── config.rs │ │ ├── contract_interactions.rs │ │ ├── events.rs │ │ ├── lib.rs │ │ └── proxy_deployer_proxy.rs │ ├── tests │ │ └── proxy_deployer_blackbox_test.rs │ ├── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── ~ │ │ └── .cargo │ │ └── settings.toml ├── proxy-pause │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── scenarios │ │ ├── init.scen.json │ │ └── pause-and-unpause.scen.json │ ├── src │ │ ├── pause_sc_proxy.rs │ │ └── proxy_pause.rs │ ├── tests │ │ ├── proxy_pause_scenario_go_test.rs │ │ └── proxy_pause_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── rewards-distribution │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── src │ │ ├── rewards_distribution.rs │ │ └── seed_nft_minter_proxy.rs │ ├── tests │ │ ├── compute_brackets_whitebox_test.rs │ │ ├── mock_seed_nft_minter.rs │ │ ├── test_raffle_and_claim_legacy_test.rs │ │ └── utils.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── seed-nft-minter │ ├── .gitignore │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── src │ │ ├── distribution_module.rs │ │ ├── nft_marketplace_proxy.rs │ │ ├── nft_module.rs │ │ └── seed_nft_minter.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── token-release │ ├── Cargo.toml │ ├── meta │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── multiversx.json │ ├── scenarios │ │ ├── test-add-group.scen.json │ │ ├── test-add-user.scen.json │ │ ├── test-change-user.scen.json │ │ ├── test-claim.scen.json │ │ ├── test-end-setup.scen.json │ │ └── test-init.scen.json │ ├── src │ │ ├── contract_data.rs │ │ └── token_release.rs │ ├── tests │ │ ├── token_release_scenario_go_test.rs │ │ └── token_release_scenario_rs_test.rs │ └── wasm │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs └── wegld-swap │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ ├── interaction │ └── snippets.sh │ ├── meta │ ├── Cargo.toml │ └── src │ │ └── main.rs │ ├── multiversx.json │ ├── sc-config.toml │ ├── scenarios │ ├── unwrap_egld.scen.json │ └── wrap_egld.scen.json │ ├── src │ ├── wegld.rs │ └── wegld_proxy.rs │ ├── tests │ ├── scenario_go_test.rs │ └── wegld_swap_scenario_rs_test.rs │ └── wasm │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ └── lib.rs └── multiversx.workspace.json /.github/workflows/actions.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | permissions: 10 | checks: write 11 | pull-requests: write 12 | 13 | jobs: 14 | contracts: 15 | name: Contracts 16 | uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v4.2.2 17 | with: 18 | rust-toolchain: 1.86 19 | enable-contracts-size-report: true 20 | enable-interactor-tests: true 21 | secrets: 22 | token: ${{ secrets.GITHUB_TOKEN }} 23 | -------------------------------------------------------------------------------- /.github/workflows/on_pull_request_build_contracts.yml: -------------------------------------------------------------------------------- 1 | name: On pull request, build contracts 2 | 3 | on: 4 | pull_request: 5 | 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | build: 11 | uses: multiversx/mx-sc-actions/.github/workflows/reproducible-build.yml@v4.2.2 12 | with: 13 | image_tag: v10.0.0 14 | package_whole_project_src: true 15 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: On release, build contracts 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | permissions: 8 | contents: write 9 | 10 | jobs: 11 | build: 12 | uses: multiversx/mx-sc-actions/.github/workflows/reproducible-build.yml@v4.2.2 13 | with: 14 | image_tag: v10.0.0 15 | attach_to_existing_release: true 16 | package_whole_project_src: true 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | **/target** 4 | 5 | # These are backup files generated by rustfmt 6 | **/*.rs.bk 7 | 8 | # VSCode specific files 9 | .vscode 10 | 11 | # The mxpy output 12 | **/output/** 13 | **/*.interaction.json 14 | -------------------------------------------------------------------------------- /contracts/adder/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | /output*/ 8 | 9 | # Mandos test trace 10 | trace*.scen.json 11 | -------------------------------------------------------------------------------- /contracts/adder/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "adder" 3 | version = "0.0.0" 4 | authors = ["Andrei Marinica "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/adder.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/adder/README.md: -------------------------------------------------------------------------------- 1 | # Adder 2 | 3 | `Adder` is a simple Smart Contract. 4 | -------------------------------------------------------------------------------- /contracts/adder/interaction/devnet.snippets.sh: -------------------------------------------------------------------------------- 1 | ALICE="${USERS}/alice.pem" 2 | ADDRESS=$(mxpy data load --key=address-devnet) 3 | DEPLOY_TRANSACTION=$(mxpy data load --key=deployTransaction-devnet) 4 | 5 | deploy() { 6 | mxpy --verbose contract deploy --project=${PROJECT} --recall-nonce --pem=${ALICE} --gas-limit=50000000 --arguments 0 --send --outfile="deploy-devnet.interaction.json" || return 7 | 8 | TRANSACTION=$(mxpy data parse --file="deploy-devnet.interaction.json" --expression="data['emittedTransactionHash']") 9 | ADDRESS=$(mxpy data parse --file="deploy-devnet.interaction.json" --expression="data['contractAddress']") 10 | 11 | mxpy data store --key=address-devnet --value=${ADDRESS} 12 | mxpy data store --key=deployTransaction-devnet --value=${TRANSACTION} 13 | 14 | echo "" 15 | echo "Smart contract address: ${ADDRESS}" 16 | } 17 | 18 | add() { 19 | read -p "Enter number: " NUMBER 20 | mxpy --verbose contract call ${ADDRESS} --recall-nonce --pem=${ALICE} --gas-limit=50000000 --function="add" --arguments ${NUMBER} --send 21 | } 22 | 23 | getSum() { 24 | mxpy --verbose contract query ${ADDRESS} --function="getSum" 25 | } 26 | -------------------------------------------------------------------------------- /contracts/adder/interaction/testnet.snippets.sh: -------------------------------------------------------------------------------- 1 | ALICE="${USERS}/alice.pem" 2 | ADDRESS=$(mxpy data load --key=address-testnet) 3 | DEPLOY_TRANSACTION=$(mxpy data load --key=deployTransaction-testnet) 4 | PROXY=https://testnet-api.multiversx.com 5 | 6 | deploy() { 7 | mxpy contract deploy --bytecode=${PROJECT} --recall-nonce --pem=${ALICE} --gas-limit=50000000 --arguments 0 --send --outfile="deploy-testnet.interaction.json" --proxy=${PROXY} --chain=T || return 8 | 9 | TRANSACTION=$(mxpy data parse --file="deploy-testnet.interaction.json" --expression="data['emittedTransactionHash']") 10 | ADDRESS=$(mxpy data parse --file="deploy-testnet.interaction.json" --expression="data['contractAddress']") 11 | 12 | mxpy data store --key=address-testnet --value=${ADDRESS} 13 | mxpy data store --key=deployTransaction-testnet --value=${TRANSACTION} 14 | 15 | echo "" 16 | echo "Smart contract address: ${ADDRESS}" 17 | } 18 | 19 | add() { 20 | read -p "Enter number: " NUMBER 21 | mxpy contract call ${ADDRESS} --recall-nonce --pem=${ALICE} --gas-limit=5000000 --function="add" --arguments ${NUMBER} --send --proxy=${PROXY} --chain=T 22 | } 23 | 24 | getSum() { 25 | mxpy contract query ${ADDRESS} --function="getSum" --proxy=${PROXY} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/adder/interactor/.gitignore: -------------------------------------------------------------------------------- 1 | # Pem files are used for interactions, but shouldn't be committed 2 | *.pem 3 | 4 | # Temporary storage of deployed contract address, so we can preserve the context between executions. 5 | state.toml 6 | -------------------------------------------------------------------------------- /contracts/adder/interactor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [[bin]] 2 | name = "basic-interactor" 3 | path = "src/basic_interactor_main.rs" 4 | 5 | [package] 6 | name = "basic-interactor" 7 | version = "0.0.0" 8 | authors = ["MultiversX "] 9 | edition = "2021" 10 | publish = false 11 | 12 | [lib] 13 | path = "src/basic_interactor.rs" 14 | 15 | [dependencies] 16 | toml = "0.8.6" 17 | 18 | [dependencies.adder] 19 | path = ".." 20 | 21 | [dependencies.multiversx-sc-snippets] 22 | version = "0.57.1" 23 | 24 | [dependencies.clap] 25 | version = "4.4.7" 26 | features = ["derive"] 27 | 28 | [dependencies.serde] 29 | version = "1.0" 30 | features = ["derive"] 31 | 32 | [dependencies.tokio] 33 | version = "1.24" 34 | 35 | [features] 36 | chain-simulator-tests = [] 37 | -------------------------------------------------------------------------------- /contracts/adder/interactor/config.toml: -------------------------------------------------------------------------------- 1 | # chain_type = 'simulator' 2 | # gateway_uri = 'http://localhost:8085' 3 | 4 | chain_type = 'real' 5 | gateway_uri = 'https://devnet-gateway.multiversx.com' 6 | -------------------------------------------------------------------------------- /contracts/adder/interactor/src/basic_interactor_main.rs: -------------------------------------------------------------------------------- 1 | extern crate basic_interactor; 2 | 3 | #[tokio::main] 4 | pub async fn main() { 5 | basic_interactor::adder_cli().await; 6 | } 7 | -------------------------------------------------------------------------------- /contracts/adder/interactor/tests/basic_interactor_cs_test.rs: -------------------------------------------------------------------------------- 1 | use basic_interactor::{AdderInteract, Config}; 2 | 3 | #[tokio::test] 4 | #[cfg_attr(not(feature = "chain-simulator-tests"), ignore)] 5 | async fn simulator_upgrade_test() { 6 | let mut basic_interact = AdderInteract::new(Config::chain_simulator_config()).await; 7 | 8 | basic_interact.deploy().await; 9 | basic_interact.add(1u32).await; 10 | 11 | // Sum will be 1 12 | let sum = basic_interact.get_sum().await; 13 | assert_eq!(sum, 1u32.into()); 14 | 15 | basic_interact 16 | .upgrade(7u32, &basic_interact.adder_owner_address.clone(), None) 17 | .await; 18 | 19 | // Sum will be the updated value of 7 20 | let sum = basic_interact.get_sum().await; 21 | assert_eq!(sum, 7u32.into()); 22 | 23 | // Upgrade fails 24 | basic_interact 25 | .upgrade( 26 | 10u32, 27 | &basic_interact.wallet_address.clone(), 28 | Some("upgrade is allowed only for owner"), 29 | ) 30 | .await; 31 | 32 | // Sum will remain 7 33 | let sum = basic_interact.get_sum().await; 34 | assert_eq!(sum, 7u32.into()); 35 | } 36 | -------------------------------------------------------------------------------- /contracts/adder/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "adder-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.adder] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/adder/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/adder/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/adder/mxsc-template.toml: -------------------------------------------------------------------------------- 1 | name = "adder" 2 | contract_trait = "Adder" 3 | src_file = "adder.rs" 4 | rename_pairs = [ 5 | [ 6 | "blockchain.set_current_dir_from_workspace(\"contracts/examples/adder\");", 7 | "// blockchain.set_current_dir_from_workspace(\"relative path to your workspace, if applicable\");", 8 | ], 9 | ] 10 | files_include = [ 11 | "meta", 12 | "scenarios", 13 | "src", 14 | "tests", 15 | "Cargo.toml", 16 | "README.md", 17 | "sc-config.toml", 18 | "multiversx.json", 19 | "interactor/Cargo.toml", 20 | "interactor/config.toml", 21 | "interactor/.gitignore", 22 | "interactor/src", 23 | "interactor/tests", 24 | ] 25 | has_interactor = true 26 | -------------------------------------------------------------------------------- /contracts/adder/sc-config.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | 3 | [[proxy]] 4 | path = "src/adder_proxy.rs" 5 | -------------------------------------------------------------------------------- /contracts/adder/src/adder.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | use multiversx_sc::imports::*; 4 | 5 | pub mod adder_proxy; 6 | 7 | /// One of the simplest smart contracts possible, 8 | /// it holds a single variable in storage, which anyone can increment. 9 | #[multiversx_sc::contract] 10 | pub trait Adder { 11 | #[view(getSum)] 12 | #[storage_mapper("sum")] 13 | fn sum(&self) -> SingleValueMapper; 14 | 15 | #[init] 16 | fn init(&self, initial_value: BigUint) { 17 | self.sum().set(initial_value); 18 | } 19 | 20 | #[upgrade] 21 | fn upgrade(&self, initial_value: BigUint) { 22 | self.init(initial_value); 23 | } 24 | 25 | /// Add desired amount to the storage variable. 26 | #[endpoint] 27 | fn add(&self, value: BigUint) { 28 | self.sum().update(|sum| *sum += value); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /contracts/adder/tests/adder_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn adder_go() { 9 | world().run("scenarios/adder.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn interactor_trace_go() { 14 | world().run("scenarios/interactor_trace.scen.json"); 15 | } 16 | -------------------------------------------------------------------------------- /contracts/adder/tests/adder_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | 6 | blockchain.set_current_dir_from_workspace("contracts/adder"); 7 | blockchain.register_contract("mxsc:output/adder.mxsc.json", adder::ContractBuilder); 8 | blockchain 9 | } 10 | 11 | #[test] 12 | fn adder_rs() { 13 | world().run("scenarios/adder.scen.json"); 14 | } 15 | 16 | #[test] 17 | fn interactor_trace_rs() { 18 | world().run("scenarios/interactor_trace.scen.json"); 19 | } 20 | -------------------------------------------------------------------------------- /contracts/adder/tests/adder_unit_test.rs: -------------------------------------------------------------------------------- 1 | use adder::*; 2 | use multiversx_sc::types::BigUint; 3 | use multiversx_sc_scenario::api::SingleTxApi; 4 | 5 | #[test] 6 | fn adder_unit_test() { 7 | let adder = adder::contract_obj::(); 8 | 9 | adder.init(BigUint::from(5u32)); 10 | assert_eq!(BigUint::from(5u32), adder.sum().get()); 11 | 12 | adder.add(BigUint::from(7u32)); 13 | assert_eq!(BigUint::from(12u32), adder.sum().get()); 14 | 15 | adder.add(BigUint::from(1u32)); 16 | assert_eq!(BigUint::from(13u32), adder.sum().get()); 17 | } 18 | -------------------------------------------------------------------------------- /contracts/adder/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "adder-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.adder] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/adder/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Upgrade: 1 9 | // Endpoints: 2 10 | // Async Callback (empty): 1 11 | // Total number of exported functions: 5 12 | 13 | #![no_std] 14 | 15 | multiversx_sc_wasm_adapter::allocator!(); 16 | multiversx_sc_wasm_adapter::panic_handler!(); 17 | 18 | multiversx_sc_wasm_adapter::endpoints! { 19 | adder 20 | ( 21 | init => init 22 | upgrade => upgrade 23 | getSum => sum 24 | add => add 25 | ) 26 | } 27 | 28 | multiversx_sc_wasm_adapter::async_callback_empty! {} 29 | -------------------------------------------------------------------------------- /contracts/bonding-curve-contract/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/bonding-curve-contract/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bonding-curve-contract" 3 | version = "0.0.0" 4 | authors = ["Alin Cruceat "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/bonding_curve_contract.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dependencies.multiversx-sc-modules] 15 | version = "0.57.1" 16 | 17 | [dev-dependencies.multiversx-sc-scenario] 18 | version = "0.57.1" 19 | -------------------------------------------------------------------------------- /contracts/bonding-curve-contract/docs/linear.md: -------------------------------------------------------------------------------- 1 | # Linear Function 2 | 3 | The logic is 4 | 5 | `ax + b = y` 6 | 7 | where: 8 | 9 | - x - `issued token` 10 | - y - `exchanging token` 11 | - a - `linear_coefficient` 12 | - b - `initial_price` of the token (in the role of the constant coefficient) 13 | 14 | Because of selling n tokens at a time, the total price y' will be 15 | `a* (nx + (n - 1) n / 2) + nb = y'` 16 | -------------------------------------------------------------------------------- /contracts/bonding-curve-contract/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bonding-curve-contract-meta" 3 | version = "0.0.0" 4 | authors = ["Alin Cruceat "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.bonding-curve-contract] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/bonding-curve-contract/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/bonding-curve-contract/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/bonding-curve-contract/tests/bonding_curve_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn buy_go() { 9 | world().run("scenarios/buy.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn claim_go() { 14 | world().run("scenarios/claim.scen.json"); 15 | } 16 | 17 | #[test] 18 | fn deploy_go() { 19 | world().run("scenarios/deploy.scen.json"); 20 | } 21 | 22 | #[test] 23 | fn deposit_go() { 24 | world().run("scenarios/deposit.scen.json"); 25 | } 26 | 27 | #[test] 28 | fn deposit_more_view_go() { 29 | world().run("scenarios/deposit_more_view.scen.json"); 30 | } 31 | 32 | #[test] 33 | fn sell_go() { 34 | world().run("scenarios/sell.scen.json"); 35 | } 36 | 37 | #[test] 38 | fn set_bonding_curve_go() { 39 | world().run("scenarios/set_bonding_curve.scen.json"); 40 | } 41 | -------------------------------------------------------------------------------- /contracts/bonding-curve-contract/tests/bonding_curve_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | blockchain.set_current_dir_from_workspace("contracts/bonding-curve-contract"); 6 | blockchain.register_contract( 7 | "mxsc:output/bonding-curve-contract.mxsc.json", 8 | bonding_curve_contract::ContractBuilder, 9 | ); 10 | blockchain 11 | } 12 | 13 | #[test] 14 | fn buy_rs() { 15 | world().run("scenarios/buy.scen.json"); 16 | } 17 | 18 | #[test] 19 | fn claim_rs() { 20 | world().run("scenarios/claim.scen.json"); 21 | } 22 | 23 | #[test] 24 | fn deploy_rs() { 25 | world().run("scenarios/deploy.scen.json"); 26 | } 27 | 28 | #[test] 29 | fn deposit_rs() { 30 | world().run("scenarios/deposit.scen.json"); 31 | } 32 | 33 | #[test] 34 | fn deposit_more_view_rs() { 35 | world().run("scenarios/deposit_more_view.scen.json"); 36 | } 37 | 38 | #[test] 39 | fn sell_rs() { 40 | world().run("scenarios/sell.scen.json"); 41 | } 42 | 43 | #[test] 44 | fn set_bonding_curve_rs() { 45 | world().run("scenarios/set_bonding_curve.scen.json"); 46 | } 47 | -------------------------------------------------------------------------------- /contracts/bonding-curve-contract/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "bonding-curve-contract-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.bonding-curve-contract] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/bonding-curve-contract/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 10 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 12 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | bonding_curve_contract 19 | ( 20 | init => init 21 | sellToken => sell_token_endpoint 22 | buyToken => buy_token_endpoint 23 | deposit => deposit_endpoint 24 | setBondingCurve => set_bonding_curve_endpoint 25 | claim => claim_endpoint 26 | view_buy_price => view_buy_price 27 | view_sell_price => view_sell_price 28 | getTokenAvailability => get_token_availability 29 | setLocalRoles => set_local_roles 30 | unsetLocalRoles => unset_local_roles 31 | ) 32 | } 33 | 34 | multiversx_sc_wasm_adapter::async_callback_empty! {} 35 | -------------------------------------------------------------------------------- /contracts/check-pause/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | /output*/ 8 | -------------------------------------------------------------------------------- /contracts/check-pause/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "check-pause" 3 | version = "0.0.0" 4 | authors = ["Alin Cruceat "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/check_pause.rs" 10 | 11 | [dev-dependencies] 12 | num-bigint = "0.4.2" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | 17 | [dependencies.multiversx-sc] 18 | version = "0.57.1" 19 | 20 | [dependencies.multiversx-sc-modules] 21 | version = "0.57.1" 22 | -------------------------------------------------------------------------------- /contracts/check-pause/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "check-pause-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | authors = ["Alin Cruceat "] 7 | 8 | [dependencies.check-pause] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/check-pause/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/check-pause/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/check-pause/src/check_pause.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | use multiversx_sc::imports::*; 4 | 5 | use multiversx_sc_modules::pause; 6 | 7 | #[multiversx_sc::contract] 8 | pub trait CheckPauseContract: pause::PauseModule { 9 | #[init] 10 | fn init(&self) {} 11 | 12 | #[endpoint(checkPause)] 13 | fn check_pause(&self) -> bool { 14 | self.is_paused() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /contracts/check-pause/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "check-pause-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.check-pause] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/check-pause/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 4 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 6 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | check_pause 19 | ( 20 | init => init 21 | checkPause => check_pause 22 | pause => pause_endpoint 23 | unpause => unpause_endpoint 24 | isPaused => paused_status 25 | ) 26 | } 27 | 28 | multiversx_sc_wasm_adapter::async_callback_empty! {} 29 | -------------------------------------------------------------------------------- /contracts/crowdfunding-esdt/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | 9 | # Mandos tests generated by the Rust tests 10 | scenarios-gen 11 | -------------------------------------------------------------------------------- /contracts/crowdfunding-esdt/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "crowdfunding-esdt" 3 | version = "0.0.0" 4 | authors = ["Dorin Iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/crowdfunding_esdt.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies] 15 | num-bigint = "0.4.2" 16 | num-traits = "0.2" 17 | hex = "0.4" 18 | 19 | [dev-dependencies.multiversx-sc-scenario] 20 | version = "0.57.1" 21 | -------------------------------------------------------------------------------- /contracts/crowdfunding-esdt/interaction/alice.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY for erd1l453hd0gt5gzdp7czpuall8ggt2dcv5zwmfdf3sd3lguxseux2fsmsgldz----- 2 | MWE5MjdlMmFmNTMwNmE5YmIyZWE3NzdmNzNlMDZlY2MwYWM5YWFhNzJmYjRlYTNm 3 | ZWNmNjU5NDUxMzk0Y2NjZmZkNjkxYmI1ZTg1ZDEwMjY4N2Q4MTA3OWRmZmNlODQy 4 | ZDRkYzMyODI3NmQyZDRjNjBkOGZkMWMzNDMzYzMyOTM= 5 | -----END PRIVATE KEY for erd1l453hd0gt5gzdp7czpuall8ggt2dcv5zwmfdf3sd3lguxseux2fsmsgldz----- 6 | -------------------------------------------------------------------------------- /contracts/crowdfunding-esdt/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "crowdfunding-esdt-meta" 3 | version = "0.0.0" 4 | authors = ["Andrei Marinica "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.crowdfunding-esdt] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/crowdfunding-esdt/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/crowdfunding-esdt/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/crowdfunding-esdt/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/crowdfunding_esdt_proxy.rs" 3 | -------------------------------------------------------------------------------- /contracts/crowdfunding-esdt/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "crowdfunding-esdt-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.crowdfunding-esdt] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/crowdfunding-esdt/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 8 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 10 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | crowdfunding_esdt 19 | ( 20 | init => init 21 | fund => fund 22 | status => status 23 | getCurrentFunds => get_current_funds 24 | claim => claim 25 | getTarget => target 26 | getDeadline => deadline 27 | getDeposit => deposit 28 | getCrowdfundingTokenIdentifier => cf_token_identifier 29 | ) 30 | } 31 | 32 | multiversx_sc_wasm_adapter::async_callback_empty! {} 33 | -------------------------------------------------------------------------------- /contracts/crypto-bubbles/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/crypto-bubbles/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "crypto-bubbles" 3 | version = "0.0.0" 4 | authors = ["Andrei Marinica "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/crypto_bubbles.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/crypto-bubbles/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "crypto-bubbles-meta" 3 | version = "0.0.0" 4 | authors = ["Andrei Marinica "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.crypto-bubbles] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/crypto-bubbles/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/crypto-bubbles/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/crypto-bubbles/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "crypto-bubbles-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.crypto-bubbles] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/crypto-bubbles/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 6 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 8 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | crypto_bubbles 19 | ( 20 | init => init 21 | topUp => top_up 22 | withdraw => withdraw 23 | joinGame => join_game 24 | rewardWinner => reward_winner 25 | rewardAndSendToWallet => reward_and_send_to_wallet 26 | balanceOf => player_balance 27 | ) 28 | } 29 | 30 | multiversx_sc_wasm_adapter::async_callback_empty! {} 31 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/common/kitty/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kitty" 3 | version = "0.0.0" 4 | authors = ["dorin-iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dependencies.random] 15 | version = "0.0.0" 16 | path = "../random" 17 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/common/kitty/src/kitty_genes.rs: -------------------------------------------------------------------------------- 1 | use super::color::*; 2 | use multiversx_sc::derive_imports::*; 3 | use random::*; 4 | 5 | #[type_abi] 6 | #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, Clone, Default)] 7 | pub struct KittyGenes { 8 | pub fur_color: Color, 9 | pub eye_color: Color, 10 | pub meow_power: u8, // the higher the value, the louder the cat 11 | } 12 | 13 | impl Randomizeable for KittyGenes { 14 | fn get_random(random: &mut Random) -> Self { 15 | KittyGenes { 16 | fur_color: Color::get_random(random), 17 | eye_color: Color::get_random(random), 18 | meow_power: random.next_u8(), 19 | } 20 | } 21 | } 22 | 23 | impl KittyGenes { 24 | pub fn get_as_u64(&self) -> u64 { 25 | (self.fur_color.as_u64() << 12 | self.eye_color.as_u64()) << 4 26 | | self.meow_power.to_be() as u64 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/common/kitty/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | mod color; 4 | mod kitty; 5 | mod kitty_genes; 6 | 7 | pub use color::Color; 8 | pub use kitty::Kitty; 9 | pub use kitty_genes::KittyGenes; 10 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/common/random/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "random" 3 | version = "0.0.0" 4 | authors = ["dorin-iancu "] 5 | edition = "2021" 6 | 7 | [lib] 8 | path = "src/lib.rs" 9 | 10 | [dependencies.multiversx-sc] 11 | version = "0.57.1" 12 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-auction/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-auction/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kitty-auction" 3 | version = "0.0.0" 4 | authors = ["dorin-iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.kitty] 12 | version = "0.0.0" 13 | path = "../common/kitty" 14 | 15 | [dependencies.kitty-ownership] 16 | version = "0.0.0" 17 | path = "../kitty-ownership" 18 | 19 | [dependencies.multiversx-sc] 20 | version = "0.57.1" 21 | 22 | [dev-dependencies.multiversx-sc-scenario] 23 | version = "0.57.1" 24 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-auction/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kitty-auction-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.kitty-auction] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-auction/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-auction/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-auction/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "kitty-auction-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.kitty-auction] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-genetic-alg/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-genetic-alg/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kitty-genetic-alg" 3 | version = "0.0.0" 4 | authors = ["dorin-iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.kitty] 12 | version = "0.0.0" 13 | path = "../common/kitty" 14 | 15 | [dependencies.random] 16 | version = "0.0.0" 17 | path = "../common/random" 18 | 19 | [dependencies.multiversx-sc] 20 | version = "0.57.1" 21 | 22 | [dev-dependencies.multiversx-sc-scenario] 23 | version = "0.57.1" 24 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-genetic-alg/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kitty-genetic-alg-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.kitty-genetic-alg] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-genetic-alg/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-genetic-alg/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-genetic-alg/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "../kitty-ownership/src/kitty_genetic_alg_proxy.rs" 3 | [[proxy.path-rename]] 4 | from = "kitty::kitty" 5 | to = "kitty" 6 | [[proxy.path-rename]] 7 | from = "kitty_genes" 8 | to = "kitty" 9 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-genetic-alg/tests/kitty_genetic_alg_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn generate_kitty_genes_go() { 9 | world().run("scenarios/generate-kitty-genes.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn init_go() { 14 | world().run("scenarios/init.scen.json"); 15 | } 16 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-genetic-alg/tests/kitty_genetic_alg_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | blockchain.set_current_dir_from_workspace("contracts/crypto-kitties/kitty-genetic-alg"); 6 | blockchain.register_contract( 7 | "mxsc:output/kitty-genetic-alg.mxsc.json", 8 | kitty_genetic_alg::ContractBuilder, 9 | ); 10 | blockchain 11 | } 12 | 13 | #[test] 14 | fn generate_kitty_genes_rs() { 15 | world().run("scenarios/generate-kitty-genes.scen.json"); 16 | } 17 | 18 | #[test] 19 | fn init_rs() { 20 | world().run("scenarios/init.scen.json"); 21 | } 22 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-genetic-alg/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "kitty-genetic-alg-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.kitty-genetic-alg] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-genetic-alg/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 1 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 3 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | kitty_genetic_alg 19 | ( 20 | init => init 21 | generateKittyGenes => generate_kitty_genes 22 | ) 23 | } 24 | 25 | multiversx_sc_wasm_adapter::async_callback_empty! {} 26 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-ownership/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-ownership/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kitty-ownership" 3 | version = "0.0.0" 4 | authors = ["dorin-iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.kitty] 12 | version = "0.0.0" 13 | path = "../common/kitty" 14 | 15 | [dependencies.random] 16 | version = "0.0.0" 17 | path = "../common/random" 18 | 19 | [dependencies.kitty-genetic-alg] 20 | version = "0.0.0" 21 | path = "../kitty-genetic-alg" 22 | 23 | [dependencies.multiversx-sc] 24 | version = "0.57.1" 25 | 26 | [dev-dependencies.multiversx-sc-scenario] 27 | version = "0.57.1" 28 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-ownership/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kitty-ownership-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.kitty-ownership] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-ownership/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-ownership/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-ownership/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "../kitty-auction/src/kitty_ownership_proxy.rs" 3 | [[proxy.path-rename]] 4 | from = "kitty::kitty" 5 | to = "kitty" 6 | 7 | [[proxy]] 8 | path = "../../crypto-zombies/src/kitty_ownership_proxy.rs" 9 | [[proxy.path-rename]] 10 | from = "kitty::kitty" 11 | to = "crate::kitty_obj" 12 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-ownership/tests/kitty_ownership_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn approve_siring_go() { 9 | world().run("scenarios/approve_siring.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn breed_ok_go() { 14 | world().run("scenarios/breed_ok.scen.json"); 15 | } 16 | 17 | #[test] 18 | fn give_birth_go() { 19 | world().run("scenarios/give_birth.scen.json"); 20 | } 21 | 22 | #[test] 23 | fn init_go() { 24 | world().run("scenarios/init.scen.json"); 25 | } 26 | 27 | #[test] 28 | fn query_go() { 29 | world().run("scenarios/query.scen.json"); 30 | } 31 | 32 | #[test] 33 | fn setup_accounts_go() { 34 | world().run("scenarios/setup_accounts.scen.json"); 35 | } 36 | -------------------------------------------------------------------------------- /contracts/crypto-kitties/kitty-ownership/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "kitty-ownership-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.kitty-ownership] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/crypto-zombies/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output* 8 | 9 | # Mandos test trace 10 | trace*.scen.json 11 | -------------------------------------------------------------------------------- /contracts/crypto-zombies/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "crypto-zombies" 3 | version = "0.0.0" 4 | authors = ["Alin Cruceat "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/crypto-zombies/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "crypto-zombies-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.crypto-zombies] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/crypto-zombies/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/crypto-zombies/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/crypto-zombies/mxsc-template.toml: -------------------------------------------------------------------------------- 1 | name = "crypto-zombies" 2 | contract_trait = "CryptoZombies" 3 | src_file = "lib.rs" 4 | rename_pairs = [] 5 | files_include = [ 6 | "meta", 7 | "scenarios", 8 | "src", 9 | "tests", 10 | "wasm/Cargo.toml", 11 | "Cargo.toml", 12 | ] 13 | -------------------------------------------------------------------------------- /contracts/crypto-zombies/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/proxy_crypto_zombies.rs" 3 | -------------------------------------------------------------------------------- /contracts/crypto-zombies/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | use multiversx_sc::imports::*; 4 | 5 | pub mod kitty_obj; 6 | pub mod kitty_ownership_proxy; 7 | pub mod proxy_crypto_zombies; 8 | mod storage; 9 | mod zombie; 10 | mod zombie_attack; 11 | mod zombie_factory; 12 | mod zombie_feeding; 13 | mod zombie_helper; 14 | 15 | #[multiversx_sc::contract] 16 | pub trait CryptoZombies: 17 | zombie_factory::ZombieFactory 18 | + zombie_feeding::ZombieFeeding 19 | + storage::Storage 20 | + zombie_helper::ZombieHelper 21 | + zombie_attack::ZombieAttack 22 | { 23 | #[init] 24 | fn init(&self) { 25 | self.dna_digits().set(16u8); 26 | self.attack_victory_probability().set(70u8); 27 | self.level_up_fee().set(BigUint::from(1000000000000000u64)); 28 | self.cooldown_time().set(86400u64); 29 | } 30 | 31 | #[upgrade] 32 | fn upgrade(&self) {} 33 | 34 | #[only_owner] 35 | #[endpoint] 36 | fn set_crypto_kitties_sc_address(&self, address: ManagedAddress) { 37 | self.crypto_kitties_sc_address().set(address); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /contracts/crypto-zombies/src/zombie.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::{derive_imports::*, imports::*}; 2 | 3 | #[type_abi] 4 | #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] 5 | pub struct Zombie { 6 | pub name: ManagedBuffer, 7 | pub dna: u64, 8 | pub level: u16, 9 | pub ready_time: u64, 10 | pub win_count: usize, 11 | pub loss_count: usize, 12 | } 13 | -------------------------------------------------------------------------------- /contracts/crypto-zombies/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "crypto-zombies-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.crypto-zombies] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/digital-cash/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/digital-cash/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "digital-cash" 3 | version = "0.0.0" 4 | authors = ["Valentin Craciun"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/digital_cash.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/digital-cash/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "digital-cash-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.digital-cash] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/digital-cash/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/digital-cash/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/digital-cash/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/digital_cash_proxy.rs" 3 | -------------------------------------------------------------------------------- /contracts/digital-cash/src/constants.rs: -------------------------------------------------------------------------------- 1 | pub const NON_EXISTENT_KEY_ERR_MSG: &[u8] = b"non-existent key"; 2 | pub const FEES_NOT_COVERED_ERR_MSG: &[u8] = b"fees not covered"; 3 | pub const CANNOT_DEPOSIT_FUNDS_ERR_MSG: &[u8] = 4 | b"cannot deposit funds without covering the fee cost first"; 5 | pub const SECONDS_PER_ROUND: u64 = 6; 6 | -------------------------------------------------------------------------------- /contracts/digital-cash/src/deposit_info.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::{derive_imports::*, imports::*}; 2 | 3 | #[type_abi] 4 | #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] 5 | pub struct DepositInfo { 6 | pub depositor_address: ManagedAddress, 7 | pub esdt_funds: ManagedVec>, 8 | pub egld_funds: BigUint, 9 | pub valability: u64, 10 | pub expiration_round: u64, 11 | pub fees: Fee, 12 | } 13 | 14 | impl DepositInfo 15 | where 16 | M: ManagedTypeApi, 17 | { 18 | pub fn get_num_tokens(&self) -> usize { 19 | let mut amount = self.esdt_funds.len(); 20 | if self.egld_funds > 0 { 21 | amount += 1; 22 | } 23 | 24 | amount 25 | } 26 | } 27 | 28 | #[type_abi] 29 | #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] 30 | pub struct Fee { 31 | pub num_token_to_transfer: usize, 32 | pub value: EgldOrEsdtTokenPayment, 33 | } 34 | -------------------------------------------------------------------------------- /contracts/digital-cash/src/storage.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::imports::*; 2 | 3 | use crate::deposit_info::*; 4 | 5 | #[multiversx_sc::module] 6 | pub trait StorageModule { 7 | #[view] 8 | #[storage_mapper("deposit")] 9 | fn deposit(&self, donor: &ManagedAddress) -> SingleValueMapper>; 10 | 11 | #[storage_mapper("fee")] 12 | fn fee(&self, token: &EgldOrEsdtTokenIdentifier) -> SingleValueMapper; 13 | 14 | #[storage_mapper("collectedFees")] 15 | fn collected_fees(&self, token: &EgldOrEsdtTokenIdentifier) -> SingleValueMapper; 16 | 17 | #[storage_mapper("whitelistedFeeTokens")] 18 | fn whitelisted_fee_tokens(&self) -> UnorderedSetMapper; 19 | 20 | #[storage_mapper("allTimeFeeTokens")] 21 | fn all_time_fee_tokens(&self) -> UnorderedSetMapper; 22 | } 23 | -------------------------------------------------------------------------------- /contracts/digital-cash/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "digital-cash-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.digital-cash] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/digital-cash/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 12 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 14 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | digital_cash 19 | ( 20 | init => init 21 | whitelistFeeToken => whitelist_fee_token 22 | blacklistFeeToken => blacklist_fee_token 23 | claimFees => claim_fees 24 | getAmount => get_amount 25 | payFeeAndFundESDT => pay_fee_and_fund_esdt 26 | payFeeAndFundEGLD => pay_fee_and_fund_egld 27 | fund => fund 28 | depositFees => deposit_fees 29 | withdraw => withdraw 30 | claim => claim 31 | forward => forward 32 | deposit => deposit 33 | ) 34 | } 35 | 36 | multiversx_sc_wasm_adapter::async_callback_empty! {} 37 | -------------------------------------------------------------------------------- /contracts/dn404/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dn404" 3 | version = "0.0.0" 4 | authors = ["you"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "=0.57.1" 13 | 14 | [dependencies.multiversx-sc-modules] 15 | version = "=0.57.1" 16 | 17 | [dev-dependencies] 18 | num-bigint = "0.4.2" 19 | num-traits = "0.2" 20 | hex = "0.4" 21 | hex-literal = "0.4.1" 22 | 23 | [dev-dependencies.multiversx-sc-scenario] 24 | version = "=0.57.1" 25 | -------------------------------------------------------------------------------- /contracts/dn404/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dn404-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.dn404] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "=0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/dn404/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/dn404/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/dn404/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/dn404_proxy.rs" -------------------------------------------------------------------------------- /contracts/dn404/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "dn404-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.dn404] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "=0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/empty/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | /output*/ 8 | -------------------------------------------------------------------------------- /contracts/empty/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "empty" 3 | version = "0.0.0" 4 | authors = ["you"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/empty.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies] 15 | num-bigint = "0.4.2" 16 | 17 | [dev-dependencies.multiversx-sc-scenario] 18 | version = "0.57.1" 19 | -------------------------------------------------------------------------------- /contracts/empty/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "empty-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.empty] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/empty/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/empty/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/empty/mxsc-template.toml: -------------------------------------------------------------------------------- 1 | name = "empty" 2 | contract_trait = "EmptyContract" 3 | src_file = "empty.rs" 4 | rename_pairs = [ 5 | [ 6 | "blockchain.set_current_dir_from_workspace(\"contracts/examples/empty\");", 7 | "// blockchain.set_current_dir_from_workspace(\"relative path to your workspace, if applicable\");", 8 | ], 9 | ] 10 | files_include = [ 11 | "meta", 12 | "scenarios", 13 | "src", 14 | "tests", 15 | "wasm/Cargo.toml", 16 | "Cargo.toml", 17 | ] 18 | -------------------------------------------------------------------------------- /contracts/empty/scenarios/empty.scen.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "empty", 3 | "steps": [ 4 | { 5 | "step": "setState", 6 | "accounts": { 7 | "address:owner": { 8 | "nonce": "1", 9 | "balance": "0" 10 | } 11 | }, 12 | "newAddresses": [ 13 | { 14 | "creatorAddress": "address:owner", 15 | "creatorNonce": "1", 16 | "newAddress": "sc:empty" 17 | } 18 | ] 19 | }, 20 | { 21 | "step": "scDeploy", 22 | "id": "deploy", 23 | "tx": { 24 | "from": "address:owner", 25 | "contractCode": "mxsc:../output/empty.mxsc.json", 26 | "arguments": [], 27 | "gasLimit": "5,000,000", 28 | "gasPrice": "0" 29 | }, 30 | "expect": { 31 | "out": [], 32 | "status": "", 33 | "logs": [], 34 | "gas": "*", 35 | "refund": "*" 36 | } 37 | } 38 | ] 39 | } -------------------------------------------------------------------------------- /contracts/empty/src/empty.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | #[allow(unused_imports)] 4 | use multiversx_sc::imports::*; 5 | 6 | /// An empty contract. To be used as a template when starting a new contract from scratch. 7 | #[multiversx_sc::contract] 8 | pub trait EmptyContract { 9 | #[init] 10 | fn init(&self) {} 11 | 12 | #[upgrade] 13 | fn upgrade(&self) {} 14 | } 15 | -------------------------------------------------------------------------------- /contracts/empty/tests/empty_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn empty_go() { 9 | world().run("scenarios/empty.scen.json"); 10 | } 11 | -------------------------------------------------------------------------------- /contracts/empty/tests/empty_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | 6 | blockchain.set_current_dir_from_workspace("contracts/empty"); 7 | blockchain.register_contract("mxsc:output/empty.mxsc.json", empty::ContractBuilder); 8 | blockchain 9 | } 10 | 11 | #[test] 12 | fn empty_rs() { 13 | world().run("scenarios/empty.scen.json"); 14 | } 15 | -------------------------------------------------------------------------------- /contracts/empty/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "empty-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.empty] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/empty/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Upgrade: 1 9 | // Endpoints: 0 10 | // Async Callback (empty): 1 11 | // Total number of exported functions: 3 12 | 13 | #![no_std] 14 | 15 | multiversx_sc_wasm_adapter::allocator!(); 16 | multiversx_sc_wasm_adapter::panic_handler!(); 17 | 18 | multiversx_sc_wasm_adapter::endpoints! { 19 | empty 20 | ( 21 | init => init 22 | upgrade => upgrade 23 | ) 24 | } 25 | 26 | multiversx_sc_wasm_adapter::async_callback_empty! {} 27 | -------------------------------------------------------------------------------- /contracts/erc3643/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "erc3643" 3 | version = "0.0.0" 4 | authors = ["you"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "=0.57.1" 13 | 14 | [dependencies.multiversx-sc-modules] 15 | version = "=0.57.1" 16 | 17 | [dev-dependencies] 18 | num-bigint = "0.4.2" 19 | 20 | [dev-dependencies.multiversx-sc-scenario] 21 | version = "=0.57.1" 22 | -------------------------------------------------------------------------------- /contracts/erc3643/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "erc3643-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.erc3643] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "=0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/erc3643/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/erc3643/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/erc3643/src/hooks/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod call_hook; 2 | pub mod change_hooks; 3 | pub mod hook_type; 4 | -------------------------------------------------------------------------------- /contracts/erc3643/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | use multiversx_sc::imports::*; 4 | 5 | pub mod exchange_actions; 6 | pub mod hooks; 7 | pub mod token; 8 | pub mod transfer; 9 | pub mod users; 10 | 11 | #[multiversx_sc::contract] 12 | pub trait Erc3643: 13 | users::UsersModule 14 | + token::TokenModule 15 | + hooks::call_hook::CallHookModule 16 | + hooks::change_hooks::ChangeHooksModule 17 | + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule 18 | + multiversx_sc_modules::pause::PauseModule 19 | { 20 | #[init] 21 | fn init(&self) { 22 | self.set_paused(true); 23 | } 24 | 25 | #[upgrade] 26 | fn upgrade(&self) {} 27 | } 28 | -------------------------------------------------------------------------------- /contracts/erc3643/src/users.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::imports::*; 2 | 3 | #[multiversx_sc::module] 4 | pub trait UsersModule { 5 | #[only_owner] 6 | #[endpoint(addUsers)] 7 | fn add_users(&self, users: MultiValueEncoded) { 8 | let mapper = self.user_whitelist(); 9 | for user in users { 10 | mapper.add(&user); 11 | } 12 | } 13 | 14 | #[only_owner] 15 | #[endpoint(removeUsers)] 16 | fn remove_users(&self, users: MultiValueEncoded) { 17 | let mapper = self.user_whitelist(); 18 | for user in users { 19 | mapper.remove(&user); 20 | } 21 | } 22 | 23 | #[view(isUserWhitelisted)] 24 | fn is_user_whitelisted(&self, user: ManagedAddress) -> bool { 25 | self.user_whitelist().contains(&user) 26 | } 27 | 28 | fn require_whitelisted(&self, user: &ManagedAddress) { 29 | require!( 30 | self.user_whitelist().contains(user), 31 | "May not call this function" 32 | ); 33 | } 34 | 35 | #[storage_mapper("userWhitelist")] 36 | fn user_whitelist(&self) -> WhitelistMapper; 37 | } 38 | -------------------------------------------------------------------------------- /contracts/erc3643/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "erc3643-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.erc3643] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "=0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | /output*/ 8 | -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "esdt-transfer-with-fee" 3 | version = "0.0.0" 4 | authors = ["Alin Cruceat "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/esdt_transfer_with_fee.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/README.md: -------------------------------------------------------------------------------- 1 | # Interaction 2 | 3 | The contract allows transfering token with the `ESDTRoleTransfer` role. 4 | 5 | The owner can set a fee for the contract, being one of 2 possible types: 6 | 7 | - `ExactValue` - `EsdtTokenPayment` type with desired token + amount per token transfered 8 | - `Percentage` - % of the transfered token (this number is multiplied by 100 so that we can have 2 decimal percentages. ex.: 12,50% percentage fee will be set with 1250) 9 | 10 | The transfer endpoint requires the tokens having a `ExactValue` type fee to have the fee as the following token in exact amount. 11 | The `Percentage` type will make the fee to be taken from the value transfered. 12 | 13 | Tokens that have no fee set will be simply transfered without additional requirements. 14 | -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "esdt-transfer-with-fee-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.esdt-transfer-with-fee] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/src/fee.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::derive_imports::*; 2 | use multiversx_sc::imports::*; 3 | 4 | pub(crate) const PERCENTAGE_DIVISOR: u32 = 10_000; // dividing the percentage fee by this number will result in a 2 decimal percentage 5 | 6 | #[type_abi] 7 | #[derive(TopEncode, TopDecode, PartialEq, Eq, Clone)] 8 | pub enum Fee 9 | where 10 | M: ManagedTypeApi, 11 | { 12 | Unset, 13 | ExactValue(EsdtTokenPayment), 14 | Percentage(u32), 15 | } 16 | -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn claim_go() { 9 | world().run("scenarios/claim.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn deploy_go() { 14 | world().run("scenarios/deploy.scen.json"); 15 | } 16 | 17 | #[test] 18 | fn setup_fees_and_transfer_go() { 19 | world().run("scenarios/setup_fees_and_transfer.scen.json"); 20 | } 21 | -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | 6 | blockchain.set_current_dir_from_workspace("contracts/esdt-transfer-with-fee"); 7 | blockchain.register_contract( 8 | "mxsc:output/esdt-transfer-with-fee.mxsc.json", 9 | esdt_transfer_with_fee::ContractBuilder, 10 | ); 11 | blockchain 12 | } 13 | 14 | #[test] 15 | fn claim_rs() { 16 | world().run("scenarios/claim.scen.json"); 17 | } 18 | 19 | #[test] 20 | fn deploy_rs() { 21 | world().run("scenarios/deploy.scen.json"); 22 | } 23 | 24 | #[test] 25 | fn setup_fees_and_transfer_rs() { 26 | world().run("scenarios/setup_fees_and_transfer.scen.json"); 27 | } 28 | -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "esdt-transfer-with-fee-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.esdt-transfer-with-fee] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/esdt-transfer-with-fee/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 6 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 8 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | esdt_transfer_with_fee 19 | ( 20 | init => init 21 | setExactValueFee => set_exact_value_fee 22 | setPercentageFee => set_percentage_fee 23 | claimFees => claim_fees 24 | transfer => transfer 25 | getTokenFee => token_fee 26 | getPaidFees => paid_fees 27 | ) 28 | } 29 | 30 | multiversx_sc_wasm_adapter::async_callback_empty! {} 31 | -------------------------------------------------------------------------------- /contracts/factorial/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/factorial/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "factorial" 3 | version = "0.0.0" 4 | authors = ["Andrei Marinica "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/factorial.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/factorial/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "factorial-meta" 3 | version = "0.0.0" 4 | authors = ["Andrei Marinica "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.factorial] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/factorial/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/factorial/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/factorial/scenarios/factorial.scen.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "factorial", 3 | "steps": [ 4 | { 5 | "step": "setState", 6 | "accounts": { 7 | "address:owner": { 8 | "nonce": "1", 9 | "balance": "0" 10 | }, 11 | "sc:factorial": { 12 | "code": "mxsc:../output/factorial.mxsc.json" 13 | } 14 | } 15 | }, 16 | { 17 | "step": "scQuery", 18 | "id": "factorial(3)", 19 | "tx": { 20 | "to": "sc:factorial", 21 | "function": "factorial", 22 | "arguments": [ 23 | "3" 24 | ] 25 | }, 26 | "expect": { 27 | "out": [ 28 | "6" 29 | ], 30 | "status": "", 31 | "logs": [] 32 | } 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /contracts/factorial/src/factorial.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | #[allow(unused_imports)] 4 | use multiversx_sc::imports::*; 5 | 6 | #[multiversx_sc::contract] 7 | pub trait Factorial { 8 | #[init] 9 | fn init(&self) {} 10 | 11 | #[upgrade] 12 | fn upgrade(&self) {} 13 | 14 | #[endpoint] 15 | fn factorial(&self, value: BigUint) -> BigUint { 16 | let one = BigUint::from(1u32); 17 | if value == 0 { 18 | return one; 19 | } 20 | 21 | let mut result = BigUint::from(1u32); 22 | let mut x = BigUint::from(1u32); 23 | while x <= value { 24 | result *= &x; 25 | x += &one; 26 | } 27 | 28 | result 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /contracts/factorial/tests/factorial_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn factorial_go() { 9 | world().run("scenarios/factorial.scen.json"); 10 | } 11 | -------------------------------------------------------------------------------- /contracts/factorial/tests/factorial_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | 6 | blockchain.set_current_dir_from_workspace("contracts/factorial"); 7 | blockchain.register_contract( 8 | "mxsc:output/factorial.mxsc.json", 9 | factorial::ContractBuilder, 10 | ); 11 | blockchain 12 | } 13 | 14 | #[test] 15 | fn factorial_rs() { 16 | world().run("scenarios/factorial.scen.json"); 17 | } 18 | -------------------------------------------------------------------------------- /contracts/factorial/tests/factorial_test.rs: -------------------------------------------------------------------------------- 1 | use factorial::*; 2 | use multiversx_sc::types::BigUint; 3 | use multiversx_sc_scenario::api::StaticApi; 4 | 5 | #[test] 6 | fn test_factorial() { 7 | let factorial = factorial::contract_obj::(); 8 | 9 | assert_eq!( 10 | BigUint::::from(1u32), 11 | factorial.factorial(0u32.into()) 12 | ); 13 | assert_eq!( 14 | BigUint::::from(1u32), 15 | factorial.factorial(1u32.into()) 16 | ); 17 | assert_eq!( 18 | BigUint::::from(2u32), 19 | factorial.factorial(2u32.into()) 20 | ); 21 | assert_eq!( 22 | BigUint::::from(6u32), 23 | factorial.factorial(3u32.into()) 24 | ); 25 | assert_eq!( 26 | BigUint::::from(24u32), 27 | factorial.factorial(4u32.into()) 28 | ); 29 | assert_eq!( 30 | BigUint::::from(120u32), 31 | factorial.factorial(5u32.into()) 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /contracts/factorial/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "factorial-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.factorial] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/factorial/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Upgrade: 1 9 | // Endpoints: 1 10 | // Async Callback (empty): 1 11 | // Total number of exported functions: 4 12 | 13 | #![no_std] 14 | 15 | multiversx_sc_wasm_adapter::allocator!(); 16 | multiversx_sc_wasm_adapter::panic_handler!(); 17 | 18 | multiversx_sc_wasm_adapter::endpoints! { 19 | factorial 20 | ( 21 | init => init 22 | upgrade => upgrade 23 | factorial => factorial 24 | ) 25 | } 26 | 27 | multiversx_sc_wasm_adapter::async_callback_empty! {} 28 | -------------------------------------------------------------------------------- /contracts/fair-launch/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/fair-launch/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fair-launch" 3 | version = "0.0.0" 4 | authors = ["you"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | features = ["esdt-token-payment-legacy-decode"] 14 | 15 | [dependencies.multiversx-sc-modules] 16 | version = "0.57.1" 17 | 18 | [dev-dependencies] 19 | num-bigint = "0.4.2" 20 | num-traits = "0.2" 21 | hex = "0.4" 22 | 23 | [dev-dependencies.multiversx-sc-scenario] 24 | version = "0.57.1" 25 | 26 | [dev-dependencies.crowdfunding-esdt] 27 | path = "../crowdfunding-esdt" 28 | 29 | [dev-dependencies.pair-mock] 30 | path = "../pair-mock" 31 | -------------------------------------------------------------------------------- /contracts/fair-launch/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fair-launch-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.fair-launch] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/fair-launch/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/fair-launch/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/fair-launch/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/fair_launch_proxy.rs" -------------------------------------------------------------------------------- /contracts/fair-launch/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "fair-launch-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.fair-launch] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/fractional-nfts/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/fractional-nfts/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fractional-nfts" 3 | version = "0.0.0" 4 | authors = ["Claudiu-Marcel Bruda "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/fractional_nfts.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dependencies.multiversx-sc-modules] 15 | version = "0.57.1" 16 | 17 | [dev-dependencies.multiversx-sc-scenario] 18 | version = "0.57.1" 19 | -------------------------------------------------------------------------------- /contracts/fractional-nfts/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fractional-nfts-meta" 3 | version = "0.0.0" 4 | authors = ["Claudiu-Marcel Bruda "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.fractional-nfts] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/fractional-nfts/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/fractional-nfts/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/fractional-nfts/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "fractional-nfts-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.fractional-nfts] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/fractional-nfts/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 4 9 | // Async Callback: 1 10 | // Total number of exported functions: 6 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | fractional_nfts 19 | ( 20 | init => init 21 | claimRoyaltiesFromMarketplace => claim_royalties_from_marketplace 22 | fractionalizeNFT => fractionalize_nft 23 | unFractionalizeNFT => unfractionalize_nft 24 | getFractionalToken => fractional_token 25 | ) 26 | } 27 | 28 | multiversx_sc_wasm_adapter::async_callback! { fractional_nfts } 29 | -------------------------------------------------------------------------------- /contracts/generic-composable-tasks/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "generic-composable-tasks" 3 | version = "0.0.0" 4 | publish = false 5 | edition = "2021" 6 | authors = ["you"] 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dependencies.multiversx-sc-modules] 15 | version = "0.57.1" 16 | 17 | [dev-dependencies] 18 | num-bigint = "0.4" 19 | 20 | [dev-dependencies.multiversx-sc-scenario] 21 | version = "0.57.1" 22 | 23 | [dev-dependencies.multiversx-wegld-swap-sc] 24 | path = "../wegld-swap" 25 | -------------------------------------------------------------------------------- /contracts/generic-composable-tasks/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "generic-composable-tasks-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.generic-composable-tasks] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/generic-composable-tasks/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/generic-composable-tasks/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/generic-composable-tasks/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | multiversx_sc::imports!(); 4 | 5 | pub mod call_dispatcher; 6 | pub mod high_level_calls; 7 | pub mod raw_call; 8 | pub mod unique_payments; 9 | 10 | #[multiversx_sc::contract] 11 | pub trait GenericComposableTasks: 12 | raw_call::simple_transfer::SimpleTransferModule 13 | + raw_call::sync_call::SyncCallModule 14 | + raw_call::async_call::AsyncCallModule 15 | + raw_call::common::CommonModule 16 | + high_level_calls::HighLevelCallsModule 17 | + call_dispatcher::CallDispatcherModule 18 | + multiversx_sc_modules::pause::PauseModule 19 | { 20 | #[init] 21 | fn init(&self) {} 22 | 23 | #[upgrade] 24 | fn upgrade(&self) {} 25 | } 26 | -------------------------------------------------------------------------------- /contracts/generic-composable-tasks/src/raw_call/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod async_call; 2 | pub mod common; 3 | pub mod simple_transfer; 4 | pub mod sync_call; 5 | -------------------------------------------------------------------------------- /contracts/generic-composable-tasks/src/raw_call/simple_transfer.rs: -------------------------------------------------------------------------------- 1 | use super::common::PaymentsVec; 2 | 3 | multiversx_sc::imports!(); 4 | 5 | #[multiversx_sc::module] 6 | pub trait SimpleTransferModule: super::common::CommonModule { 7 | // TODO: Use the new API which returns the tokens if it fails, when it's added to the framework 8 | 9 | fn perform_simple_transfer_egld(&self, to: &ManagedAddress, egld_value: &BigUint) { 10 | self.require_dest_not_self(to); 11 | 12 | self.send().direct_egld(to, egld_value); 13 | } 14 | 15 | fn perform_simple_transfer_esdt( 16 | &self, 17 | to: &ManagedAddress, 18 | esdt_payments: &PaymentsVec, 19 | ) { 20 | self.require_dest_not_self(to); 21 | self.require_not_empty_payments(esdt_payments); 22 | 23 | self.send().direct_multi(to, esdt_payments); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /contracts/generic-composable-tasks/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "generic-composable-tasks-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.generic-composable-tasks] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/generic-composable-tasks/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Upgrade: 1 9 | // Endpoints: 4 10 | // Async Callback (empty): 1 11 | // Promise callbacks: 1 12 | // Total number of exported functions: 8 13 | 14 | #![no_std] 15 | 16 | multiversx_sc_wasm_adapter::allocator!(); 17 | multiversx_sc_wasm_adapter::panic_handler!(); 18 | 19 | multiversx_sc_wasm_adapter::endpoints! { 20 | generic_composable_tasks 21 | ( 22 | init => init 23 | upgrade => upgrade 24 | multiCall => multi_call 25 | pause => pause_endpoint 26 | unpause => unpause_endpoint 27 | isPaused => paused_status 28 | raw_async_callback => raw_async_callback 29 | ) 30 | } 31 | 32 | multiversx_sc_wasm_adapter::async_callback_empty! {} 33 | -------------------------------------------------------------------------------- /contracts/liquid-locking/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/liquid-locking/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "liquid-locking" 3 | version = "0.0.0" 4 | authors = ["Alin Cruceat "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dev-dependencies] 12 | num-bigint = "0.4.2" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | 17 | [dependencies.multiversx-sc] 18 | version = "0.57.1" 19 | -------------------------------------------------------------------------------- /contracts/liquid-locking/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "liquid-locking-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | authors = ["you"] 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.liquid-locking] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | default-features = false 16 | -------------------------------------------------------------------------------- /contracts/liquid-locking/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/liquid-locking/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/liquid-locking/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/liquid_locking_proxy.rs" -------------------------------------------------------------------------------- /contracts/liquid-locking/scenarios/empty.scen.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liquid-locking", 3 | "steps": [ 4 | { 5 | "step": "setState", 6 | "accounts": { 7 | "address:owner": { 8 | "nonce": "1", 9 | "balance": "0" 10 | } 11 | }, 12 | "newAddresses": [ 13 | { 14 | "creatorAddress": "address:owner", 15 | "creatorNonce": "1", 16 | "newAddress": "sc:empty" 17 | } 18 | ] 19 | }, 20 | { 21 | "step": "scDeploy", 22 | "id": "deploy", 23 | "tx": { 24 | "from": "address:owner", 25 | "contractCode": "mxsc:../output/liquid-locking.mxsc.json", 26 | "arguments": [], 27 | "gasLimit": "5,000,000", 28 | "gasPrice": "0" 29 | }, 30 | "expect": { 31 | "out": [], 32 | "status": "", 33 | "logs": [], 34 | "gas": "*", 35 | "refund": "*" 36 | } 37 | } 38 | ] 39 | } -------------------------------------------------------------------------------- /contracts/liquid-locking/src/unlocked_token.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::{api::ManagedTypeApi, types::EsdtTokenPayment}; 2 | 3 | use multiversx_sc::derive_imports::*; 4 | 5 | #[type_abi] 6 | #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, ManagedVecItem)] 7 | pub struct UnlockedToken { 8 | pub token: EsdtTokenPayment, 9 | pub unbond_epoch: u64, 10 | } 11 | -------------------------------------------------------------------------------- /contracts/liquid-locking/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "liquid-locking-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.liquid-locking] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/lottery-esdt/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/lottery-esdt/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "lottery-esdt" 3 | version = "0.0.0" 4 | authors = ["Dorin Iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lottery.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/lottery-esdt/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "lottery-esdt-meta" 3 | version = "0.0.0" 4 | authors = ["Andrei Marinica "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.lottery-esdt] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/lottery-esdt/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/lottery-esdt/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/lottery-esdt/src/lottery_info.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::{ 2 | api::ManagedTypeApi, 3 | types::{BigUint, EgldOrEsdtTokenIdentifier, ManagedVec}, 4 | }; 5 | 6 | use multiversx_sc::derive_imports::*; 7 | 8 | #[type_abi] 9 | #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] 10 | pub struct LotteryInfo { 11 | pub token_identifier: EgldOrEsdtTokenIdentifier, 12 | pub ticket_price: BigUint, 13 | pub tickets_left: usize, 14 | pub deadline: u64, 15 | pub max_entries_per_user: usize, 16 | pub prize_distribution: ManagedVec, 17 | pub prize_pool: BigUint, 18 | } 19 | -------------------------------------------------------------------------------- /contracts/lottery-esdt/src/status.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::derive_imports::*; 2 | 3 | #[type_abi] 4 | #[derive(TopEncode, TopDecode, PartialEq, Eq, Clone, Copy)] 5 | pub enum Status { 6 | Inactive, 7 | Running, 8 | Ended, 9 | } 10 | -------------------------------------------------------------------------------- /contracts/lottery-esdt/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "lottery-esdt-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.lottery-esdt] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/lottery-esdt/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 7 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 9 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | lottery_esdt 19 | ( 20 | init => init 21 | start => start 22 | createLotteryPool => create_lottery_pool 23 | buy_ticket => buy_ticket 24 | determine_winner => determine_winner 25 | status => status 26 | getLotteryInfo => lottery_info 27 | getLotteryWhitelist => lottery_whitelist 28 | ) 29 | } 30 | 31 | multiversx_sc_wasm_adapter::async_callback_empty! {} 32 | -------------------------------------------------------------------------------- /contracts/multisig/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/multisig/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "multisig" 3 | version = "1.0.0" 4 | authors = ["Andrei Marinica "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/multisig.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dependencies.multiversx-sc-modules] 15 | version = "0.57.1" 16 | 17 | [dev-dependencies] 18 | num-bigint = "0.4.2" 19 | num-traits = "0.2" 20 | hex = "0.4" 21 | 22 | [dev-dependencies.multiversx-sc-scenario] 23 | version = "0.57.1" 24 | 25 | [dev-dependencies.adder] 26 | path = "../adder" 27 | 28 | [dev-dependencies.factorial] 29 | path = "../factorial" 30 | 31 | [dev-dependencies.multiversx-wegld-swap-sc] 32 | version = "0.57.0" 33 | -------------------------------------------------------------------------------- /contracts/multisig/interact/.gitignore: -------------------------------------------------------------------------------- 1 | # Pem files are used for interactions, but shouldn't be committed 2 | *.pem 3 | 4 | # Temporary storage of deployed contract address, so we can preserve the context between executions. 5 | state.toml 6 | 7 | # Trace file of interactor tooling 8 | interactor*.scen.json 9 | -------------------------------------------------------------------------------- /contracts/multisig/interact/Cargo.toml: -------------------------------------------------------------------------------- 1 | [[bin]] 2 | name = "multisig-interact" 3 | path = "src/multisig_interact.rs" 4 | 5 | [package] 6 | name = "multisig-interact" 7 | version = "0.0.0" 8 | authors = ["Andrei Marinica "] 9 | edition = "2021" 10 | publish = false 11 | 12 | [dependencies] 13 | toml = "0.8.6" 14 | 15 | [dependencies.clap] 16 | version = "4.4.7" 17 | features = ["derive"] 18 | 19 | [dependencies.serde] 20 | version = "1.0" 21 | features = ["derive"] 22 | 23 | [dependencies.multisig] 24 | path = ".." 25 | 26 | [dependencies.multiversx-sc-modules] 27 | version = "0.57.1" 28 | 29 | [dependencies.multiversx-sc-snippets] 30 | version = "0.57.1" 31 | 32 | [dependencies.multiversx-sc-scenario] 33 | version = "=0.57.1" 34 | 35 | [dependencies.multiversx-sc] 36 | version = "=0.57.1" 37 | -------------------------------------------------------------------------------- /contracts/multisig/interact/config.toml: -------------------------------------------------------------------------------- 1 | chain_type = 'real' 2 | gateway_uri = 'https://devnet-gateway.multiversx.com' 3 | quorum = 2 4 | wegld_address = "erd1qqqqqqqqqqqqqpgqqkwzsxkjc83vlfex9dmznwm7tjvxlqqkpauqx0n782" 5 | -------------------------------------------------------------------------------- /contracts/multisig/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "multisig-meta" 3 | version = "0.0.0" 4 | authors = ["Andrei Marinica "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.multisig] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/multisig/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/multisig/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } 4 | -------------------------------------------------------------------------------- /contracts/multisig/sc-config.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | main = "main" 3 | 4 | [contracts.main] 5 | name = "multisig" 6 | add-unlabelled = true 7 | 8 | [contracts.full] 9 | name = "multisig-full" 10 | add-unlabelled = true 11 | add-labels = ["multisig-external-view"] 12 | 13 | [contracts.view] 14 | name = "multisig-view" 15 | external-view = true 16 | add-unlabelled = false 17 | add-labels = ["multisig-external-view"] 18 | -------------------------------------------------------------------------------- /contracts/multisig/scenarios/changeBoard.scen.json: -------------------------------------------------------------------------------- 1 | { 2 | "steps": [ 3 | { 4 | "step": "externalSteps", 5 | "path": "steps/init_accounts.steps.json" 6 | }, 7 | { 8 | "step": "externalSteps", 9 | "path": "steps/deploy.steps.json" 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /contracts/multisig/scenarios/deploy_duplicate_bm.scen.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": "add then check", 3 | "steps": [ 4 | { 5 | "step": "externalSteps", 6 | "path": "steps/init_accounts.steps.json" 7 | }, 8 | { 9 | "step": "scDeploy", 10 | "id": "multisig-deploy", 11 | "tx": { 12 | "from": "address:owner", 13 | "contractCode": "file:../output/multisig.wasm", 14 | "arguments": [ 15 | "2", 16 | "address:alice", 17 | "address:alice" 18 | ], 19 | "gasLimit": "50,000,000", 20 | "gasPrice": "0" 21 | }, 22 | "expect": { 23 | "out": [], 24 | "status": "4", 25 | "message": "str:duplicate board member", 26 | "logs": "*", 27 | "gas": "*", 28 | "refund": "*" 29 | } 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /contracts/multisig/src/user_role.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::derive_imports::*; 2 | 3 | #[type_abi] 4 | #[derive(TopEncode, TopDecode, Clone, Copy, PartialEq, Eq, Debug)] 5 | pub enum UserRole { 6 | None, 7 | Proposer, 8 | BoardMember, 9 | } 10 | 11 | impl UserRole { 12 | pub fn can_propose(&self) -> bool { 13 | matches!(*self, UserRole::BoardMember | UserRole::Proposer) 14 | } 15 | 16 | pub fn can_perform_action(&self) -> bool { 17 | self.can_propose() 18 | } 19 | 20 | pub fn can_discard_action(&self) -> bool { 21 | self.can_propose() 22 | } 23 | 24 | pub fn can_sign(&self) -> bool { 25 | matches!(*self, UserRole::BoardMember) 26 | } 27 | 28 | pub fn has_no_role(&self) -> bool { 29 | matches!(*self, UserRole::None) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /contracts/multisig/test-contracts/adder.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multiversx/mx-contracts-rs/d451bc58c6a15d06b2e149c04257b1049171a51d/contracts/multisig/test-contracts/adder.wasm -------------------------------------------------------------------------------- /contracts/multisig/test-contracts/factorial.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multiversx/mx-contracts-rs/d451bc58c6a15d06b2e149c04257b1049171a51d/contracts/multisig/test-contracts/factorial.wasm -------------------------------------------------------------------------------- /contracts/multisig/wasm-multisig-full/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "multisig-full-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.multisig] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/multisig/wasm-multisig-view/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "multisig-view-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.multisig] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/multisig/wasm-multisig/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "multisig-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.multisig] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/mvx-game-sc/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | /output*/ 8 | 9 | # Mandos test trace 10 | trace*.scen.json 11 | -------------------------------------------------------------------------------- /contracts/mvx-game-sc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mvx-game-sc" 3 | version = "0.0.0" 4 | authors = ["Mihai Calin Luca calin.luca@multiversx.com"] 5 | edition = "2018" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/mvx-game-sc/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mvx-game-sc-meta" 3 | version = "0.0.0" 4 | edition = "2018" 5 | publish = false 6 | authors = ["you"] 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.mvx-game-sc] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | default-features = false 16 | -------------------------------------------------------------------------------- /contracts/mvx-game-sc/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/mvx-game-sc/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/mvx-game-sc/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/game_proxy.rs" -------------------------------------------------------------------------------- /contracts/mvx-game-sc/src/types.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::derive_imports::*; 2 | use multiversx_sc::imports::*; 3 | 4 | #[type_abi] 5 | #[derive( 6 | TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, ManagedVecItem, Debug, PartialEq, 7 | )] 8 | pub enum Status { 9 | Valid, 10 | Invalid, 11 | } 12 | 13 | #[type_abi] 14 | #[derive( 15 | TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, ManagedVecItem, Debug, PartialEq, 16 | )] 17 | pub struct GameSettings { 18 | pub time_limit: u64, //start_time + waiting time 19 | pub number_of_players_min: u64, //min and max 20 | pub number_of_players_max: u64, 21 | pub wager: BigUint, 22 | pub creator: ManagedAddress, 23 | pub status: Status, 24 | } 25 | -------------------------------------------------------------------------------- /contracts/mvx-game-sc/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "mvx-game-sc-wasm" 9 | version = "0.0.0" 10 | edition = "2018" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.mvx-game-sc] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/mystery-box/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The erdpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/mystery-box/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mystery-box" 3 | version = "0.0.1" 4 | authors = ["you"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dependencies.multiversx-sc-modules] 15 | version = "0.57.1" 16 | 17 | [dev-dependencies.multiversx-sc-scenario] 18 | version = "0.57.1" 19 | -------------------------------------------------------------------------------- /contracts/mystery-box/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mystery-box-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.mystery-box] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/mystery-box/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/mystery-box/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/mystery-box/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/mystery_box_proxy.rs" -------------------------------------------------------------------------------- /contracts/mystery-box/testnet.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multiversx/mx-contracts-rs/d451bc58c6a15d06b2e149c04257b1049171a51d/contracts/mystery-box/testnet.toml -------------------------------------------------------------------------------- /contracts/mystery-box/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "mystery-box-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.mystery-box] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/nft-escrow/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | /output*/ 8 | -------------------------------------------------------------------------------- /contracts/nft-escrow/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nft-escrow" 3 | version = "0.0.0" 4 | authors = ["you"] 5 | edition = "2018" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/nft-escrow/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nft-escrow-meta" 3 | version = "0.0.0" 4 | edition = "2018" 5 | publish = false 6 | authors = ["you"] 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.nft-escrow] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | default-features = false 16 | -------------------------------------------------------------------------------- /contracts/nft-escrow/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/nft-escrow/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/nft-escrow/mxsc-template.toml: -------------------------------------------------------------------------------- 1 | name = "empty" 2 | contract_trait = "EmptyContract" 3 | src_file = "empty.rs" 4 | rename_pairs = [ 5 | [ 6 | "blockchain.set_current_dir_from_workspace(\"contracts/examples/empty\");", 7 | "// blockchain.set_current_dir_from_workspace(\"relative path to your workspace, if applicable\");", 8 | ], 9 | ] 10 | files_include = [ 11 | "meta", 12 | "scenarios", 13 | "src", 14 | "tests", 15 | "wasm/Cargo.toml", 16 | "Cargo.toml", 17 | "multiversx.json", 18 | ] 19 | -------------------------------------------------------------------------------- /contracts/nft-escrow/tests/nft_escrow_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn accept_go() { 9 | world().run("scenarios/accept.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn cancel_go() { 14 | world().run("scenarios/cancel.scen.json"); 15 | } 16 | 17 | #[test] 18 | fn escrow_go() { 19 | world().run("scenarios/escrow.scen.json"); 20 | } 21 | 22 | #[test] 23 | fn init_go() { 24 | world().run("scenarios/init.scen.json"); 25 | } 26 | 27 | #[test] 28 | fn views_go() { 29 | world().run("scenarios/views.scen.json"); 30 | } 31 | -------------------------------------------------------------------------------- /contracts/nft-escrow/tests/nft_escrow_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | 6 | blockchain.set_current_dir_from_workspace("contracts/nft-escrow"); 7 | blockchain.register_contract( 8 | "mxsc:output/nft-escrow.mxsc.json", 9 | nft_escrow::ContractBuilder, 10 | ); 11 | blockchain 12 | } 13 | 14 | #[test] 15 | #[ignore = "not supported"] 16 | fn accept_rs() { 17 | world().run("scenarios/accept.scen.json"); 18 | } 19 | 20 | #[test] 21 | #[ignore = "not supported"] 22 | fn cancel_rs() { 23 | world().run("scenarios/cancel.scen.json"); 24 | } 25 | 26 | #[test] 27 | #[ignore = "not supported"] 28 | fn escrow_rs() { 29 | world().run("scenarios/escrow.scen.json"); 30 | } 31 | 32 | #[test] 33 | #[ignore = "not supported"] 34 | fn init_rs() { 35 | world().run("scenarios/init.scen.json"); 36 | } 37 | 38 | #[test] 39 | #[ignore = "not supported"] 40 | fn views_rs() { 41 | world().run("scenarios/views.scen.json"); 42 | } 43 | -------------------------------------------------------------------------------- /contracts/nft-escrow/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "nft-escrow-wasm" 9 | version = "0.0.0" 10 | edition = "2018" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.nft-escrow] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/nft-escrow/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 8 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 10 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | nft_escrow 19 | ( 20 | init => init 21 | escrow => escrow 22 | cancel => cancel 23 | accept => accept 24 | getCreatedOffers => get_created_offers 25 | getWantedOffers => get_wanted_offers 26 | created_offers => created_offers 27 | wanted_offers => wanted_offers 28 | offers => offers 29 | ) 30 | } 31 | 32 | multiversx_sc_wasm_adapter::async_callback_empty! {} 33 | -------------------------------------------------------------------------------- /contracts/nft-minter/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/nft-minter/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nft-minter" 3 | version = "0.0.0" 4 | authors = ["Dorin Iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/nft-minter/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nft-minter-meta" 3 | version = "0.0.0" 4 | authors = ["Dorin Iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.nft-minter] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/nft-minter/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/nft-minter/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/nft-minter/tests/nft_minter_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | 6 | blockchain.set_current_dir_from_workspace("contracts/nft-minter"); 7 | blockchain.register_contract( 8 | "mxsc:output/nft-minter.mxsc.json", 9 | nft_minter::ContractBuilder, 10 | ); 11 | blockchain 12 | } 13 | 14 | #[test] 15 | #[ignore = "not supported"] 16 | fn buy_nft_rs() { 17 | world().run("scenarios/buy_nft.scen.json"); 18 | } 19 | 20 | #[test] 21 | #[ignore = "not supported"] 22 | fn create_nft_rs() { 23 | world().run("scenarios/create_nft.scen.json"); 24 | } 25 | 26 | #[test] 27 | #[ignore = "not supported"] 28 | fn init_rs() { 29 | world().run("scenarios/init.scen.json"); 30 | } 31 | -------------------------------------------------------------------------------- /contracts/nft-minter/tests/scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn buy_nft_go() { 9 | world().run("scenarios/buy_nft.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn create_nft_go() { 14 | world().run("scenarios/create_nft.scen.json"); 15 | } 16 | 17 | #[test] 18 | fn init_go() { 19 | world().run("scenarios/init.scen.json"); 20 | } 21 | -------------------------------------------------------------------------------- /contracts/nft-minter/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "nft-minter-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.nft-minter] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/nft-minter/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 6 9 | // Async Callback: 1 10 | // Total number of exported functions: 8 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | nft_minter 19 | ( 20 | init => init 21 | createNft => create_nft 22 | claimRoyaltiesFromMarketplace => claim_royalties_from_marketplace 23 | issueToken => issue_token 24 | setLocalRoles => set_local_roles 25 | buyNft => buy_nft 26 | getNftPrice => get_nft_price 27 | ) 28 | } 29 | 30 | multiversx_sc_wasm_adapter::async_callback! { nft_minter } 31 | -------------------------------------------------------------------------------- /contracts/nft-storage-prepay/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/nft-storage-prepay/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nft-storage-prepay" 3 | version = "0.0.0" 4 | authors = ["Dorin Iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/nft_storage_prepay.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/nft-storage-prepay/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nft-storage-prepay-meta" 3 | version = "0.0.0" 4 | authors = ["Dorin Iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.nft-storage-prepay] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | default-features = false 16 | -------------------------------------------------------------------------------- /contracts/nft-storage-prepay/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/nft-storage-prepay/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/nft-storage-prepay/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "nft-storage-prepay-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.nft-storage-prepay] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/nft-storage-prepay/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 8 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 10 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | nft_storage_prepay 19 | ( 20 | init => init 21 | setCostPerByte => set_cost_per_byte 22 | reserveFunds => reserve_funds 23 | claim => claim 24 | depositPaymentForStorage => deposit_payment_for_storage 25 | withdraw => withdraw 26 | getCostForSize => get_cost_for_size 27 | getDepositAmount => get_deposit_amount 28 | getCostPerByte => cost_per_byte 29 | ) 30 | } 31 | 32 | multiversx_sc_wasm_adapter::async_callback_empty! {} 33 | -------------------------------------------------------------------------------- /contracts/on-chain-claim/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | /output*/ 8 | 9 | # Mandos test trace 10 | trace*.scen.json 11 | 12 | wallet.pem -------------------------------------------------------------------------------- /contracts/on-chain-claim/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "on-chain-claim" 3 | version = "0.0.0" 4 | authors = ["Vlad Bucur "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/contract.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dependencies.multiversx-sc-modules] 15 | version = "0.57.1" 16 | 17 | [dev-dependencies.multiversx-sc-scenario] 18 | version = "0.57.1" 19 | -------------------------------------------------------------------------------- /contracts/on-chain-claim/README.md: -------------------------------------------------------------------------------- 1 | # On Chain Claim 2 | 3 | `On Chain Claim` is a simple Smart Contract. 4 | -------------------------------------------------------------------------------- /contracts/on-chain-claim/interaction/testnet.snippets.sh: -------------------------------------------------------------------------------- 1 | WALLET="${PWD}/wallet.pem" 2 | PROJECT="${PWD}" 3 | PROXY=https://testnet-gateway.multiversx.com 4 | CHAINID=D 5 | 6 | DEPLOY_GAS="30000000" 7 | SFT_IDENTIFIER=0x54525245504149522d626435323730 #XSTRREPAIR-e1b673 8 | deploy() { 9 | mxpy --verbose contract deploy \ 10 | --bytecode="output/on-chain-claim.mxsc.json" \ 11 | --arguments ${SFT_IDENTIFIER} \ 12 | --pem=${WALLET} \ 13 | --gas-limit=${DEPLOY_GAS} \ 14 | --proxy=${PROXY} \ 15 | --chain=${CHAINID} \ 16 | --recall-nonce \ 17 | --send \ 18 | --outfile="deploy-testnet.interaction.json" || return 19 | 20 | TRANSACTION=$(mxpy data parse --file="deploy-testnet.interaction.json" --expression="data['emittedTransactionHash']") 21 | ADDRESS=$(mxpy data parse --file="deploy-testnet.interaction.json" --expression="data['contractAddress']") 22 | 23 | mxpy data store --key=address-testnet --value=${ADDRESS} 24 | mxpy data store --key=deployTransaction-testnet --value=${TRANSACTION} 25 | 26 | echo "" 27 | echo "Smart contract address: ${ADDRESS}" 28 | } 29 | -------------------------------------------------------------------------------- /contracts/on-chain-claim/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "on-chain-claim-meta" 3 | version = "0.0.0" 4 | edition = "2018" 5 | publish = false 6 | authors = ["Vlad Bucur "] 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.on-chain-claim] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | default-features = false 16 | -------------------------------------------------------------------------------- /contracts/on-chain-claim/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/on-chain-claim/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/on-chain-claim/mxsc-template.toml: -------------------------------------------------------------------------------- 1 | name = "on-chain-claim" 2 | contract_trait = "OnChainClaim" 3 | src_file = "contract.rs" 4 | rename_pairs = [ 5 | [ 6 | "blockchain.set_current_dir_from_workspace(\"contracts/examples/on-chain-claim\");", 7 | "// blockchain.set_current_dir_from_workspace(\"relative path to your workspace, if applicable\");", 8 | ], 9 | ] 10 | files_include = [ 11 | "meta", 12 | "scenarios", 13 | "src", 14 | "tests", 15 | "wasm/Cargo.toml", 16 | "Cargo.toml", 17 | "README.md", 18 | "multiversx.json", 19 | ] 20 | -------------------------------------------------------------------------------- /contracts/on-chain-claim/src/address_info.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::derive_imports::*; 2 | 3 | #[type_abi] 4 | #[derive(Default, NestedEncode, NestedDecode, TopEncode, TopDecode)] 5 | pub struct AddressInfo { 6 | pub current_streak: u64, 7 | pub last_epoch_claimed: u64, 8 | pub total_epochs_claimed: u64, 9 | pub best_streak: u64, 10 | } 11 | 12 | impl AddressInfo { 13 | pub fn new( 14 | current_streak: u64, 15 | last_epoch_claimed: u64, 16 | total_epochs_claimed: u64, 17 | best_streak: u64, 18 | ) -> Self { 19 | AddressInfo { 20 | current_streak, 21 | last_epoch_claimed, 22 | total_epochs_claimed, 23 | best_streak, 24 | } 25 | } 26 | 27 | pub fn new_with_epoch(current_epoch: u64) -> Self { 28 | AddressInfo { 29 | current_streak: 1, 30 | last_epoch_claimed: current_epoch, 31 | total_epochs_claimed: 1, 32 | best_streak: 1, 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /contracts/on-chain-claim/src/events.rs: -------------------------------------------------------------------------------- 1 | use crate::address_info::*; 2 | 3 | #[multiversx_sc::module] 4 | pub trait EventsModule { 5 | #[event("new_claim")] 6 | fn new_claim_event(&self, #[indexed] address: &ManagedAddress, info: &AddressInfo); 7 | 8 | #[event("new_claim_and_repair")] 9 | fn new_claim_and_repair_event(&self, #[indexed] address: &ManagedAddress, info: &AddressInfo); 10 | 11 | #[event("new_update_state")] 12 | fn new_update_state_event(&self, #[indexed] address: &ManagedAddress, info: &AddressInfo); 13 | } 14 | -------------------------------------------------------------------------------- /contracts/on-chain-claim/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "on-chain-claim-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.on-chain-claim] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/order-book/.gitignore: -------------------------------------------------------------------------------- 1 | # IDE 2 | **/node_modules 3 | **/output/** 4 | **/testnet/** 5 | **/wallets/** 6 | **/mxpy.data-storage.json 7 | **/*.interaction.json 8 | -------------------------------------------------------------------------------- /contracts/order-book/factory/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/order-book/factory/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "order-book-factory" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [lib] 8 | path = "src/lib.rs" 9 | 10 | [dependencies.multiversx-sc] 11 | version = "0.57.1" 12 | 13 | [dev-dependencies.multiversx-sc-scenario] 14 | version = "0.57.1" 15 | -------------------------------------------------------------------------------- /contracts/order-book/factory/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "factory-meta" 3 | version = "0.0.0" 4 | authors = ["you"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.order-book-factory] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/order-book/factory/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/order-book/factory/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/order-book/factory/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "order-book-factory-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.order-book-factory] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/order-book/factory/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 2 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 4 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | order_book_factory 19 | ( 20 | init => init 21 | createPair => create_pair 22 | getPair => get_pair 23 | ) 24 | } 25 | 26 | multiversx_sc_wasm_adapter::async_callback_empty! {} 27 | -------------------------------------------------------------------------------- /contracts/order-book/pair/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/order-book/pair/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "order-book-pair" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [lib] 8 | path = "src/lib.rs" 9 | 10 | [dependencies.multiversx-sc] 11 | version = "0.57.1" 12 | 13 | [dev-dependencies.multiversx-sc-scenario] 14 | version = "0.57.1" 15 | -------------------------------------------------------------------------------- /contracts/order-book/pair/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pair-meta" 3 | version = "0.0.0" 4 | authors = ["you"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.order-book-pair] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/order-book/pair/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/order-book/pair/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/order-book/pair/scenarios/match_orders.scen.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "matchOrders", 3 | "steps": [ 4 | { 5 | "step": "externalSteps", 6 | "path": "steps/complete_setup.steps.json" 7 | }, 8 | { 9 | "step": "externalSteps", 10 | "path": "steps/create_buy_order.steps.json" 11 | }, 12 | { 13 | "step": "externalSteps", 14 | "path": "steps/create_sell_order.steps.json" 15 | }, 16 | { 17 | "step": "scCall", 18 | "id": "matchOrders", 19 | "tx": { 20 | "from": "address:match_provider", 21 | "to": "sc:pair", 22 | "function": "matchOrders", 23 | "arguments": [ 24 | "u64:0|u64:1" 25 | ], 26 | "gasLimit": "100,000,000", 27 | "gasPrice": "0" 28 | }, 29 | "expect": { 30 | "out": [], 31 | "status": "", 32 | "gas": "*", 33 | "refund": "*" 34 | } 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /contracts/order-book/pair/scenarios/steps/complete_setup.steps.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "init accounts", 3 | "steps": [ 4 | { 5 | "step": "externalSteps", 6 | "path": "init_accounts.steps.json" 7 | }, 8 | { 9 | "step": "externalSteps", 10 | "path": "deploy.steps.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /contracts/order-book/pair/scenarios/steps/create_buy_order.steps.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "createBuyOrder", 3 | "steps": [ 4 | { 5 | "step": "scCall", 6 | "id": "createBuyOrder", 7 | "tx": { 8 | "from": "address:user1", 9 | "to": "sc:pair", 10 | "esdtValue": [ 11 | { 12 | "tokenIdentifier": "str:BUSD-abcdef", 13 | "value": "2,000,000" 14 | } 15 | ], 16 | "function": "createBuyOrder", 17 | "arguments": [ 18 | "biguint:200000|address:match_provider|0x00|biguint:1000|u64:0|u64:1000" 19 | ], 20 | "gasLimit": "100,000,000", 21 | "gasPrice": "0" 22 | }, 23 | "expect": { 24 | "out": [], 25 | "status": "", 26 | "gas": "*", 27 | "refund": "*" 28 | } 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /contracts/order-book/pair/scenarios/steps/create_sell_order.steps.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "createSellOrder", 3 | "steps": [ 4 | { 5 | "step": "scCall", 6 | "id": "createSellOrder", 7 | "tx": { 8 | "from": "address:user2", 9 | "to": "sc:pair", 10 | "esdtValue": [ 11 | { 12 | "tokenIdentifier": "str:WEGLD-abcdef", 13 | "value": "200,000" 14 | } 15 | ], 16 | "function": "createSellOrder", 17 | "arguments": [ 18 | "biguint:2000000|address:match_provider|0x00|biguint:10000|u64:0|u64:1000" 19 | ], 20 | "gasLimit": "100,000,000", 21 | "gasPrice": "0" 22 | }, 23 | "expect": { 24 | "out": [], 25 | "status": "", 26 | "gas": "*", 27 | "refund": "*" 28 | } 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /contracts/order-book/pair/scenarios/steps/deploy.steps.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "deploy router", 3 | "steps": [ 4 | { 5 | "step": "setState", 6 | "newAddresses": [ 7 | { 8 | "creatorAddress": "address:owner", 9 | "creatorNonce": "0", 10 | "newAddress": "sc:pair" 11 | } 12 | ] 13 | }, 14 | { 15 | "step": "scDeploy", 16 | "id": "deploy-router", 17 | "tx": { 18 | "from": "address:owner", 19 | "contractCode": "mxsc:../../output/order-book-pair.mxsc.json", 20 | "arguments": [ 21 | "str:WEGLD-abcdef", 22 | "str:BUSD-abcdef" 23 | ], 24 | "gasLimit": "100,000,000", 25 | "gasPrice": "0" 26 | }, 27 | "expect": { 28 | "out": [], 29 | "status": "", 30 | "gas": "*", 31 | "refund": "*" 32 | } 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /contracts/order-book/pair/src/global.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::imports::*; 2 | 3 | #[multiversx_sc::module] 4 | pub trait GlobalOperationModule { 5 | #[only_owner] 6 | #[endpoint(startGlobalOperation)] 7 | fn global_op_start(&self) { 8 | self.require_global_op_not_ongoing(); 9 | self.global_op_is_ongoing().set(true); 10 | } 11 | 12 | #[only_owner] 13 | #[endpoint(stopGlobalOperation)] 14 | fn global_op_stop(&self) { 15 | self.require_global_op_ongoing(); 16 | self.global_op_is_ongoing().set(false); 17 | } 18 | 19 | fn require_global_op_not_ongoing(&self) { 20 | require!( 21 | !self.global_op_is_ongoing().get(), 22 | "Global operation ongoing" 23 | ); 24 | } 25 | 26 | fn require_global_op_ongoing(&self) { 27 | require!( 28 | self.global_op_is_ongoing().get(), 29 | "Global operation not ongoing" 30 | ); 31 | } 32 | 33 | #[storage_mapper("global_operation_ongoing")] 34 | fn global_op_is_ongoing(&self) -> SingleValueMapper; 35 | } 36 | -------------------------------------------------------------------------------- /contracts/order-book/pair/tests/pair_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn cancel_all_orders_go() { 9 | world().run("scenarios/cancel_all_orders.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn cancel_orders_go() { 14 | world().run("scenarios/cancel_orders.scen.json"); 15 | } 16 | 17 | #[test] 18 | fn create_buy_order_check_go() { 19 | world().run("scenarios/create_buy_order_check.scen.json"); 20 | } 21 | 22 | #[test] 23 | fn create_sell_order_check_go() { 24 | world().run("scenarios/create_sell_order_check.scen.json"); 25 | } 26 | 27 | #[test] 28 | fn free_orders_go() { 29 | world().run("scenarios/free_orders.scen.json"); 30 | } 31 | 32 | #[test] 33 | fn match_orders_go() { 34 | world().run("scenarios/match_orders.scen.json"); 35 | } 36 | -------------------------------------------------------------------------------- /contracts/order-book/pair/tests/pair_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | 6 | blockchain.set_current_dir_from_workspace("contracts/order-book/pair"); 7 | blockchain.register_contract( 8 | "mxsc:output/order-book-pair.mxsc.json", 9 | order_book_pair::ContractBuilder, 10 | ); 11 | blockchain 12 | } 13 | 14 | #[test] 15 | fn cancel_all_orders_rs() { 16 | world().run("scenarios/cancel_all_orders.scen.json"); 17 | } 18 | 19 | #[test] 20 | fn cancel_orders_rs() { 21 | world().run("scenarios/cancel_orders.scen.json"); 22 | } 23 | 24 | #[test] 25 | fn create_buy_order_check_rs() { 26 | world().run("scenarios/create_buy_order_check.scen.json"); 27 | } 28 | 29 | #[test] 30 | fn create_sell_order_check_rs() { 31 | world().run("scenarios/create_sell_order_check.scen.json"); 32 | } 33 | 34 | #[test] 35 | fn free_orders_rs() { 36 | world().run("scenarios/free_orders.scen.json"); 37 | } 38 | 39 | #[test] 40 | fn match_orders_rs() { 41 | world().run("scenarios/match_orders.scen.json"); 42 | } 43 | -------------------------------------------------------------------------------- /contracts/order-book/pair/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "order-book-pair-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.order-book-pair] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/pair-mock/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pair-mock" 3 | version = "0.0.0" 4 | authors = ["you"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/pair_mock.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies] 15 | num-bigint = "0.4.2" 16 | 17 | [dev-dependencies.multiversx-sc-scenario] 18 | version = "0.57.1" 19 | -------------------------------------------------------------------------------- /contracts/pair-mock/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pair-mock-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.pair-mock] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc-meta-lib] 11 | version = "0.57.1" 12 | default-features = false 13 | -------------------------------------------------------------------------------- /contracts/pair-mock/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/pair-mock/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/pair-mock/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "../fair-launch/src/pair_mock_proxy.rs" 3 | -------------------------------------------------------------------------------- /contracts/pair-mock/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "pair-mock-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.pair-mock] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/pair-mock/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 1 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 3 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | pair_mock 19 | ( 20 | init => init 21 | swapTokensFixedInput => swap_tokens_fixed_input 22 | ) 23 | } 24 | 25 | multiversx_sc_wasm_adapter::async_callback_empty! {} 26 | -------------------------------------------------------------------------------- /contracts/paymaster/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | /output*/ 8 | -------------------------------------------------------------------------------- /contracts/paymaster/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "paymaster" 3 | version = "0.0.0" 4 | authors = ["MultiversX "] 5 | edition = "2018" 6 | publish = false 7 | readme = "README.md" 8 | 9 | [lib] 10 | path = "src/paymaster.rs" 11 | 12 | [dev-dependencies] 13 | num-bigint = "0.4.2" 14 | 15 | [dev-dependencies.multiversx-sc-scenario] 16 | version = "0.57.1" 17 | 18 | [dev-dependencies.adder] 19 | path = "../adder" 20 | 21 | [dev-dependencies.multiversx-wegld-swap-sc] 22 | path = "../wegld-swap" 23 | 24 | [dependencies.multiversx-sc] 25 | version = "0.57.1" 26 | -------------------------------------------------------------------------------- /contracts/paymaster/interactor/.gitignore: -------------------------------------------------------------------------------- 1 | # Pem files are used for interactions, but shouldn't be committed 2 | *.pem 3 | -------------------------------------------------------------------------------- /contracts/paymaster/interactor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [[bin]] 2 | name = "rust-interact" 3 | path = "src/interactor_main.rs" 4 | 5 | [package] 6 | name = "rust-interact" 7 | version = "0.0.0" 8 | authors = ["you"] 9 | edition = "2021" 10 | publish = false 11 | 12 | [dependencies] 13 | toml = "0.8.6" 14 | 15 | [dependencies.paymaster] 16 | path = ".." 17 | 18 | [dependencies.multiversx-sc-snippets] 19 | version = "0.57.1" 20 | 21 | [dependencies.multiversx-sc] 22 | version = "0.57.1" 23 | 24 | [dependencies.clap] 25 | version = "4.4.7" 26 | features = ["derive"] 27 | 28 | [dependencies.serde] 29 | version = "1.0" 30 | features = ["derive"] 31 | 32 | [features] 33 | chain-simulator-tests = [] 34 | -------------------------------------------------------------------------------- /contracts/paymaster/interactor/config.toml: -------------------------------------------------------------------------------- 1 | chain_type = 'real' 2 | gateway_uri = 'https://devnet-gateway.multiversx.com' 3 | 4 | relayer_addr = "erd19azy5vlq343un82cqz03744vmta9ya8l5xwj3ywz7r8m8pkttd0syhkffa" 5 | egld_mex_pair_address = "erd1qqqqqqqqqqqqqpgqzw0d0tj25qme9e4ukverjjjqle6xamay0n4s5r0v9g" 6 | egld_usdc_pair_address = "erd1qqqqqqqqqqqqqpgqtqfhy99su9xzjjrq59kpzpp25udtc9eq0n4sr90ax6" 7 | wegld_address = "erd1qqqqqqqqqqqqqpgqpv09kfzry5y4sj05udcngesat07umyj70n4sa2c0rp" 8 | router_address = "erd1qqqqqqqqqqqqqpgqa7hv0nahgsl8tz0psat46x0tchm0wuyc0n4s6q28ad" 9 | -------------------------------------------------------------------------------- /contracts/paymaster/interactor/state.toml: -------------------------------------------------------------------------------- 1 | contract_address = "erd1qqqqqqqqqqqqqpgqxl7k7weu3przhkkccdqskkjq2kjqsjwkd8sshcly0k" 2 | -------------------------------------------------------------------------------- /contracts/paymaster/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "paymaster-meta" 3 | version = "0.0.0" 4 | edition = "2018" 5 | publish = false 6 | authors = ["you"] 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.paymaster] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | default-features = false 16 | -------------------------------------------------------------------------------- /contracts/paymaster/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/paymaster/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/paymaster/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/paymaster_proxy.rs" 3 | 4 | [[proxy]] 5 | path = "interactor/src/proxy.rs" 6 | 7 | -------------------------------------------------------------------------------- /contracts/paymaster/scenarios/empty.scen.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "paymaster", 3 | "steps": [ 4 | { 5 | "step": "setState", 6 | "accounts": { 7 | "address:owner": { 8 | "nonce": "1", 9 | "balance": "0" 10 | } 11 | }, 12 | "newAddresses": [ 13 | { 14 | "creatorAddress": "address:owner", 15 | "creatorNonce": "1", 16 | "newAddress": "sc:empty" 17 | } 18 | ] 19 | }, 20 | { 21 | "step": "scDeploy", 22 | "id": "deploy", 23 | "tx": { 24 | "from": "address:owner", 25 | "contractCode": "mxsc:../output/paymaster.mxsc.json", 26 | "arguments": [], 27 | "gasLimit": "5,000,000", 28 | "gasPrice": "0" 29 | }, 30 | "expect": { 31 | "out": [], 32 | "status": "", 33 | "logs": [], 34 | "gas": "*", 35 | "refund": "*" 36 | } 37 | } 38 | ] 39 | } -------------------------------------------------------------------------------- /contracts/paymaster/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "paymaster-wasm" 9 | version = "0.0.0" 10 | edition = "2018" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.paymaster] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/paymaster/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Upgrade: 1 9 | // Endpoints: 1 10 | // Async Callback: 1 11 | // Total number of exported functions: 4 12 | 13 | #![no_std] 14 | 15 | multiversx_sc_wasm_adapter::allocator!(); 16 | multiversx_sc_wasm_adapter::panic_handler!(); 17 | 18 | multiversx_sc_wasm_adapter::endpoints! { 19 | paymaster 20 | ( 21 | init => init 22 | upgrade => upgrade 23 | forwardExecution => forward_execution 24 | ) 25 | } 26 | 27 | multiversx_sc_wasm_adapter::async_callback! { paymaster } 28 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ping-pong-egld" 3 | version = "0.0.2" 4 | authors = ["Bruda Claudiu-Marcel "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/ping_pong.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/deploy.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multiversx/mx-contracts-rs/d451bc58c6a15d06b2e149c04257b1049171a51d/contracts/ping-pong-egld/deploy.json -------------------------------------------------------------------------------- /contracts/ping-pong-egld/interactor/.gitignore: -------------------------------------------------------------------------------- 1 | # Pem files are used for interactions, but shouldn't be committed 2 | *.pem 3 | *.json 4 | 5 | # Temporary storage of deployed contract address, so we can preserve the context between executions. 6 | state.toml 7 | 8 | # Trace file of interactor tooling 9 | interactor_trace.scen.json 10 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/interactor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [[bin]] 2 | name = "ping-pong-egld-interact" 3 | path = "src/interact_main.rs" 4 | 5 | [package] 6 | name = "ping-pong-egld-interact" 7 | version = "0.0.0" 8 | authors = ["MultiversX "] 9 | edition = "2021" 10 | publish = false 11 | 12 | [lib] 13 | path = "src/interact.rs" 14 | 15 | [dependencies] 16 | toml = "0.8.6" 17 | 18 | [dependencies.clap] 19 | version = "4.4.7" 20 | features = ["derive"] 21 | 22 | [dependencies.serde] 23 | version = "1.0" 24 | features = ["derive"] 25 | 26 | [dependencies.tokio] 27 | version = "1.24" 28 | 29 | [dependencies.ping-pong-egld] 30 | path = ".." 31 | 32 | [dependencies.multiversx-sc-snippets] 33 | version = "0.57.1" 34 | 35 | [dependencies.multiversx-sc] 36 | version = "0.57.1" 37 | 38 | [features] 39 | chain-simulator-tests = [] 40 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/interactor/config.toml: -------------------------------------------------------------------------------- 1 | chain_type = 'simulator' 2 | gateway_uri = 'http://localhost:8085' 3 | 4 | # chain_type = 'real' 5 | # gateway_uri = 'https://devnet-gateway.multiversx.com' 6 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/interactor/src/interact_main.rs: -------------------------------------------------------------------------------- 1 | extern crate ping_pong_egld_interact; 2 | 3 | #[tokio::main] 4 | pub async fn main() { 5 | ping_pong_egld_interact::ping_pong_egld_cli().await; 6 | } 7 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ping-pong-egld-meta" 3 | version = "0.0.0" 4 | authors = ["Bruda Claudiu-Marcel "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies.ping-pong-egld] 9 | path = ".." 10 | 11 | [dependencies.multiversx-sc-meta-lib] 12 | version = "0.57.1" 13 | default-features = false 14 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/ping-pong-egld/scenarios/ping-pong-call-get-user-addresses.scen.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "call getUserAddresses in order to check who registered", 3 | "gasSchedule": "v3", 4 | "steps": [ 5 | { 6 | "step": "externalSteps", 7 | "path": "ping-pong-call-ping-second-user.scen.json" 8 | }, 9 | { 10 | "step": "scCall", 11 | "tx": { 12 | "from": "address:participant1", 13 | "to": "sc:ping-pong", 14 | "function": "getUserAddresses", 15 | "arguments": [], 16 | "gasLimit": "10,000,000", 17 | "gasPrice": "0" 18 | }, 19 | "expect": { 20 | "out": [ 21 | "address:participant1", 22 | "address:participant2" 23 | ], 24 | "status": "0", 25 | "message": "", 26 | "gas": "*", 27 | "refund": "*" 28 | } 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/scenarios/ping-pong-call-pong-all.scen.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "call pong all in order to send the funds back to everyone", 3 | "gasSchedule": "v3", 4 | "steps": [ 5 | { 6 | "step": "externalSteps", 7 | "path": "ping-pong-call-ping-second-user.scen.json" 8 | }, 9 | { 10 | "step": "setState", 11 | "currentBlockInfo": { 12 | "blockTimestamp": "123,781" 13 | } 14 | }, 15 | { 16 | "step": "externalSteps", 17 | "path": "ping-pong-call-pong-all.steps.json" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/src/types.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::derive_imports::*; 2 | use multiversx_sc::imports::*; 3 | 4 | #[type_abi] 5 | #[derive(TopEncode, TopDecode, PartialEq, Eq, Clone, Copy)] 6 | pub enum UserStatus { 7 | New, 8 | Registered, 9 | Withdrawn, 10 | } 11 | 12 | #[type_abi] 13 | #[derive(TopEncode, TopDecode, Default)] 14 | pub struct ContractState { 15 | pub ping_amount: BigUint, 16 | pub deadline: u64, 17 | pub activation_timestamp: u64, 18 | pub max_funds: Option>, 19 | pub pong_all_last_user: usize, 20 | } 21 | -------------------------------------------------------------------------------- /contracts/ping-pong-egld/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "ping-pong-egld-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.ping-pong-egld] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/price-aggregator/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | output 8 | -------------------------------------------------------------------------------- /contracts/price-aggregator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "multiversx-price-aggregator-sc" 3 | version = "0.47.1" 4 | authors = [ 5 | "Claudiu-Marcel Bruda ", 6 | "MultiversX ", 7 | ] 8 | license = "GPL-3.0-only" 9 | readme = "README.md" 10 | repository = "https://github.com/multiversx/mx-sdk-rs" 11 | homepage = "https://multiversx.com/" 12 | documentation = "https://docs.multiversx.com/" 13 | description = "MultiversX Price aggregator Smart Contract" 14 | keywords = [ 15 | "multiversx", 16 | "wasm", 17 | "webassembly", 18 | "blockchain", 19 | "contract", 20 | ] 21 | categories = [ 22 | "no-std", 23 | "wasm", 24 | "cryptography::cryptocurrencies", 25 | ] 26 | edition = "2021" 27 | 28 | [lib] 29 | path = "src/lib.rs" 30 | 31 | [dev-dependencies.multiversx-sc-scenario] 32 | version = "0.57.1" 33 | 34 | [dependencies.multiversx-sc] 35 | version = "0.57.1" 36 | 37 | [dependencies.multiversx-sc-modules] 38 | version = "0.57.1" 39 | 40 | [dependencies.arrayvec] 41 | version = "0.7.1" 42 | default-features = false 43 | 44 | [dependencies.rand] 45 | version = "0.8.5" 46 | 47 | [dependencies.getrandom] 48 | version = "0.2" 49 | features = ["js"] 50 | -------------------------------------------------------------------------------- /contracts/price-aggregator/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "multiversx-price-aggregator-sc-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies.multiversx-price-aggregator-sc] 8 | path = ".." 9 | 10 | [dependencies.multiversx-sc] 11 | version = "0.57.1" 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | default-features = false 16 | -------------------------------------------------------------------------------- /contracts/price-aggregator/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/price-aggregator/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } 4 | -------------------------------------------------------------------------------- /contracts/price-aggregator/src/median.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::imports::*; 2 | 3 | /// Returns the sorted middle, or the average of the two middle indexed items if the 4 | /// vector has an even number of elements. 5 | pub fn calculate( 6 | list: &mut [BigUint], 7 | ) -> Result>, StaticSCError> { 8 | if list.is_empty() { 9 | return Result::Ok(None); 10 | } 11 | list.sort_unstable(); 12 | let len = list.len(); 13 | let middle_index = len / 2; 14 | if len % 2 == 0 { 15 | let median1 = list.get(middle_index - 1).ok_or("median1 invalid index")?; 16 | let median2 = list.get(middle_index).ok_or("median2 invalid index")?; 17 | Result::Ok(Some((median1.clone() + median2.clone()) / 2u64)) 18 | } else { 19 | let median = list.get(middle_index).ok_or("median invalid index")?; 20 | Result::Ok(Some(median.clone())) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /contracts/price-aggregator/src/price_aggregator_data.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::derive_imports::*; 2 | use multiversx_sc::imports::*; 3 | 4 | #[type_abi] 5 | #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, Clone)] 6 | pub struct TokenPair { 7 | pub from: ManagedBuffer, 8 | pub to: ManagedBuffer, 9 | } 10 | 11 | #[type_abi] 12 | #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] 13 | pub struct PriceFeed { 14 | pub round_id: u32, 15 | pub from: ManagedBuffer, 16 | pub to: ManagedBuffer, 17 | pub timestamp: u64, 18 | pub price: BigUint, 19 | pub decimals: u8, 20 | } 21 | 22 | #[type_abi] 23 | #[derive(TopEncode, TopDecode, Debug, PartialEq, Eq)] 24 | pub struct TimestampedPrice { 25 | pub price: BigUint, 26 | pub timestamp: u64, 27 | pub decimals: u8, 28 | } 29 | 30 | #[type_abi] 31 | #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, Debug, PartialEq, Eq)] 32 | pub struct OracleStatus { 33 | pub accepted_submissions: u64, 34 | pub total_submissions: u64, 35 | } 36 | -------------------------------------------------------------------------------- /contracts/price-aggregator/tests/price_aggregator_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn price_aggregator_stress_submit_go() { 9 | world().run("scenarios/stress_submit_with_gas_schedule_test.scen.json"); 10 | } 11 | -------------------------------------------------------------------------------- /contracts/price-aggregator/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "multiversx-price-aggregator-sc-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.multiversx-price-aggregator-sc] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/proxy-deployer/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The erdpy output 7 | output* 8 | -------------------------------------------------------------------------------- /contracts/proxy-deployer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "proxy-deployer" 3 | version = "0.0.0" 4 | authors = ["MultiversX "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/lib.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "=0.57.1" 13 | features = ["esdt-token-payment-legacy-decode"] 14 | 15 | [dependencies.multiversx-sc-modules] 16 | version = "0.57.1" 17 | 18 | [dev-dependencies.multiversx-sc-scenario] 19 | version = "=0.57.1" 20 | 21 | [dev-dependencies.adder] 22 | path = "../adder" 23 | -------------------------------------------------------------------------------- /contracts/proxy-deployer/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "proxy-deployer-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | authors = ["MultiversX "] 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.proxy-deployer] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | -------------------------------------------------------------------------------- /contracts/proxy-deployer/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/proxy-deployer/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/proxy-deployer/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/proxy_deployer_proxy.rs" 3 | -------------------------------------------------------------------------------- /contracts/proxy-deployer/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | use multiversx_sc::imports::*; 4 | 5 | use multiversx_sc_modules::pause; 6 | 7 | pub mod config; 8 | pub mod contract_interactions; 9 | pub mod events; 10 | pub mod proxy_deployer_proxy; 11 | 12 | #[multiversx_sc::contract] 13 | pub trait ProxyDeployer: 14 | contract_interactions::ContractInteractionsModule 15 | + config::ConfigModule 16 | + events::EventsModule 17 | + pause::PauseModule 18 | { 19 | #[init] 20 | fn init(&self, default_gas_for_save: u64) { 21 | self.default_gas_for_save_operation() 22 | .set(default_gas_for_save); 23 | } 24 | 25 | #[upgrade] 26 | fn upgrade(&self) {} 27 | } 28 | -------------------------------------------------------------------------------- /contracts/proxy-deployer/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "proxy-deployer-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.proxy-deployer] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "=0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/proxy-deployer/~/.cargo/settings.toml: -------------------------------------------------------------------------------- 1 | profile = "default" 2 | version = "12" 3 | 4 | [overrides] 5 | -------------------------------------------------------------------------------- /contracts/proxy-pause/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "proxy-pause" 3 | version = "0.0.0" 4 | authors = ["you"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/proxy_pause.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | 17 | [dev-dependencies.check-pause] 18 | path = "../check-pause" 19 | -------------------------------------------------------------------------------- /contracts/proxy-pause/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "proxy-pause-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | authors = ["you"] 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.proxy-pause] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | default-features = false 16 | -------------------------------------------------------------------------------- /contracts/proxy-pause/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/proxy-pause/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/proxy-pause/tests/proxy_pause_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn init_go() { 9 | world().run("scenarios/init.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn pause_and_unpause_go() { 14 | world().run("scenarios/pause-and-unpause.scen.json"); 15 | } 16 | -------------------------------------------------------------------------------- /contracts/proxy-pause/tests/proxy_pause_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | 6 | blockchain.set_current_dir_from_workspace("contracts/proxy-pause"); 7 | blockchain.register_contract( 8 | "mxsc:output/proxy-pause.mxsc.json", 9 | proxy_pause::ContractBuilder, 10 | ); 11 | 12 | blockchain.register_contract( 13 | "mxsc:../check-pause/output/check-pause.mxsc.json", 14 | check_pause::ContractBuilder, 15 | ); 16 | blockchain 17 | } 18 | 19 | #[test] 20 | fn init_rs() { 21 | world().run("scenarios/init.scen.json"); 22 | } 23 | 24 | #[test] 25 | fn pause_and_unpause_rs() { 26 | world().run("scenarios/pause-and-unpause.scen.json"); 27 | } 28 | -------------------------------------------------------------------------------- /contracts/proxy-pause/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "proxy-pause-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.proxy-pause] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/proxy-pause/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 8 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 10 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | proxy_pause 19 | ( 20 | init => init 21 | addContracts => add_contracts 22 | removeContracts => remove_contracts 23 | addOwners => add_owners 24 | removeOwners => remove_owners 25 | pause => pause 26 | unpause => unpause 27 | owners => owners 28 | contracts => contracts 29 | ) 30 | } 31 | 32 | multiversx_sc_wasm_adapter::async_callback_empty! {} 33 | -------------------------------------------------------------------------------- /contracts/rewards-distribution/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | /output*/ 8 | 9 | # Mandos test trace 10 | trace*.scen.json 11 | -------------------------------------------------------------------------------- /contracts/rewards-distribution/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rewards-distribution" 3 | version = "0.0.0" 4 | authors = ["Claudiu-Marcel Bruda "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/rewards_distribution.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dependencies.multiversx-sc-modules] 15 | version = "0.57.1" 16 | 17 | [dev-dependencies.multiversx-sc-scenario] 18 | version = "0.57.1" 19 | -------------------------------------------------------------------------------- /contracts/rewards-distribution/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rewards-distribution-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | authors = ["Claudiu-Marcel Bruda "] 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.rewards-distribution] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | default-features = false 16 | -------------------------------------------------------------------------------- /contracts/rewards-distribution/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/rewards-distribution/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/rewards-distribution/tests/mock_seed_nft_minter.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::imports::*; 2 | 3 | #[multiversx_sc::contract] 4 | pub trait MockSeedNftMinter { 5 | #[init] 6 | fn init(&self, nft_token_id: TokenIdentifier) { 7 | self.nft_token_id().set(nft_token_id); 8 | } 9 | 10 | #[endpoint(setNftCount)] 11 | fn set_nft_count(&self, nft_count: u64) { 12 | self.nft_count().set(nft_count); 13 | } 14 | 15 | #[view(getNftCount)] 16 | #[storage_mapper("nft_count")] 17 | fn nft_count(&self) -> SingleValueMapper; 18 | 19 | #[view(getNftTokenId)] 20 | #[storage_mapper("nft_token_id")] 21 | fn nft_token_id(&self) -> SingleValueMapper; 22 | } 23 | -------------------------------------------------------------------------------- /contracts/rewards-distribution/tests/utils.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::types::ManagedVec; 2 | use multiversx_sc_scenario::DebugApi; 3 | use rewards_distribution::Bracket; 4 | 5 | pub fn to_brackets(brackets_vec: &[(u64, u64)]) -> ManagedVec { 6 | let mut brackets = ManagedVec::::new(); 7 | for (index_percent, bracket_reward_percent) in brackets_vec.iter().cloned() { 8 | brackets.push(Bracket { 9 | index_percent, 10 | bracket_reward_percent, 11 | }); 12 | } 13 | brackets 14 | } 15 | -------------------------------------------------------------------------------- /contracts/rewards-distribution/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "rewards-distribution-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.rewards-distribution] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/seed-nft-minter/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # The mxpy output 7 | /output*/ 8 | 9 | # Mandos test trace 10 | trace*.scen.json 11 | -------------------------------------------------------------------------------- /contracts/seed-nft-minter/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "seed-nft-minter" 3 | version = "0.0.0" 4 | authors = ["Claudiu-Marcel Bruda "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/seed_nft_minter.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dependencies.multiversx-sc-modules] 15 | version = "0.57.1" 16 | 17 | [dev-dependencies.multiversx-sc-scenario] 18 | version = "0.57.1" 19 | -------------------------------------------------------------------------------- /contracts/seed-nft-minter/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "seed-nft-minter-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | authors = ["Claudiu-Marcel Bruda "] 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.seed-nft-minter] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc-meta-lib] 14 | version = "0.57.1" 15 | default-features = false 16 | -------------------------------------------------------------------------------- /contracts/seed-nft-minter/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/seed-nft-minter/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/seed-nft-minter/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "../rewards-distribution/src/seed_nft_minter_proxy.rs" 3 | -------------------------------------------------------------------------------- /contracts/seed-nft-minter/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "seed-nft-minter-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.seed-nft-minter] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/seed-nft-minter/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 9 9 | // Async Callback: 1 10 | // Total number of exported functions: 11 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | seed_nft_minter 19 | ( 20 | init => init 21 | createNft => create_nft 22 | claimAndDistribute => claim_and_distribute 23 | getMarketplaces => marketplaces 24 | getNftCount => nft_count 25 | getDistributionRules => distribution_rules 26 | issueToken => issue_token 27 | buyNft => buy_nft 28 | getNftPrice => get_nft_price 29 | getNftTokenId => nft_token_id 30 | ) 31 | } 32 | 33 | multiversx_sc_wasm_adapter::async_callback! { seed_nft_minter } 34 | -------------------------------------------------------------------------------- /contracts/token-release/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "token-release" 3 | version = "0.0.1" 4 | authors = ["you"] 5 | edition = "2021" 6 | publish = false 7 | 8 | [lib] 9 | path = "src/token_release.rs" 10 | 11 | [dependencies.multiversx-sc] 12 | version = "0.57.1" 13 | 14 | [dev-dependencies.multiversx-sc-scenario] 15 | version = "0.57.1" 16 | -------------------------------------------------------------------------------- /contracts/token-release/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "token-release-meta" 3 | version = "0.0.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dev-dependencies] 8 | 9 | [dependencies.token-release] 10 | path = ".." 11 | 12 | [dependencies.multiversx-sc-meta-lib] 13 | version = "0.57.1" 14 | default-features = false 15 | -------------------------------------------------------------------------------- /contracts/token-release/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/token-release/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/token-release/src/contract_data.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc::{api::ManagedTypeApi, types::BigUint}; 2 | 3 | use multiversx_sc::derive_imports::*; 4 | 5 | #[type_abi] 6 | #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, PartialEq, Eq, Clone)] 7 | pub enum UnlockType { 8 | FixedAmount { 9 | period_unlock_amount: BigUint, 10 | release_period: u64, 11 | release_ticks: u64, 12 | }, 13 | Percentage { 14 | period_unlock_percentage: u8, 15 | release_period: u64, 16 | release_ticks: u64, 17 | }, 18 | } 19 | 20 | #[type_abi] 21 | #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, PartialEq, Eq, Clone)] 22 | pub struct Schedule { 23 | pub group_total_amount: BigUint, 24 | pub unlock_type: UnlockType, 25 | } 26 | -------------------------------------------------------------------------------- /contracts/token-release/tests/token_release_scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn test_add_group_go() { 9 | world().run("scenarios/test-add-group.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn test_add_user_go() { 14 | world().run("scenarios/test-add-user.scen.json"); 15 | } 16 | 17 | #[test] 18 | fn test_change_user_go() { 19 | world().run("scenarios/test-change-user.scen.json"); 20 | } 21 | 22 | #[test] 23 | fn test_claim_go() { 24 | world().run("scenarios/test-claim.scen.json"); 25 | } 26 | 27 | #[test] 28 | fn test_end_setup_go() { 29 | world().run("scenarios/test-end-setup.scen.json"); 30 | } 31 | 32 | #[test] 33 | fn test_init_go() { 34 | world().run("scenarios/test-init.scen.json"); 35 | } 36 | -------------------------------------------------------------------------------- /contracts/token-release/tests/token_release_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | 6 | blockchain.set_current_dir_from_workspace("contracts/token-release"); 7 | blockchain.register_contract( 8 | "mxsc:output/token-release.mxsc.json", 9 | token_release::ContractBuilder, 10 | ); 11 | blockchain 12 | } 13 | 14 | #[test] 15 | fn test_add_group_rs() { 16 | world().run("scenarios/test-add-group.scen.json"); 17 | } 18 | 19 | #[test] 20 | fn test_add_user_rs() { 21 | world().run("scenarios/test-add-user.scen.json"); 22 | } 23 | 24 | #[test] 25 | fn test_change_user_rs() { 26 | world().run("scenarios/test-change-user.scen.json"); 27 | } 28 | 29 | #[test] 30 | fn test_claim_rs() { 31 | world().run("scenarios/test-claim.scen.json"); 32 | } 33 | 34 | #[test] 35 | fn test_end_setup_rs() { 36 | world().run("scenarios/test-end-setup.scen.json"); 37 | } 38 | 39 | #[test] 40 | fn test_init_rs() { 41 | world().run("scenarios/test-init.scen.json"); 42 | } 43 | -------------------------------------------------------------------------------- /contracts/token-release/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "token-release-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.token-release] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/wegld-swap/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | */target/ 5 | 6 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 7 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 8 | Cargo.lock 9 | 10 | # The mxpy output 11 | output 12 | -------------------------------------------------------------------------------- /contracts/wegld-swap/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "multiversx-wegld-swap-sc" 3 | version = "0.47.1" 4 | authors = [ 5 | "Dorin Iancu ", 6 | "MultiversX ", 7 | ] 8 | license = "GPL-3.0-only" 9 | readme = "README.md" 10 | repository = "https://github.com/multiversx/mx-sdk-rs" 11 | homepage = "https://multiversx.com/" 12 | documentation = "https://docs.multiversx.com/" 13 | description = "MultiversX Wrapped EGLD Smart Contract" 14 | keywords = [ 15 | "multiversx", 16 | "wasm", 17 | "webassembly", 18 | "blockchain", 19 | "contract", 20 | ] 21 | categories = [ 22 | "no-std", 23 | "wasm", 24 | "cryptography::cryptocurrencies", 25 | ] 26 | edition = "2021" 27 | 28 | [lib] 29 | path = "src/wegld.rs" 30 | 31 | [dependencies.multiversx-sc] 32 | version = "0.57.1" 33 | 34 | [dependencies.multiversx-sc-modules] 35 | version = "0.57.1" 36 | 37 | [dev-dependencies.multiversx-sc-scenario] 38 | version = "0.57.1" 39 | -------------------------------------------------------------------------------- /contracts/wegld-swap/README.md: -------------------------------------------------------------------------------- 1 | # EGLD-WEGLD swap 2 | 3 | ## Overview 4 | 5 | The EGLD-WEGLD swap contract mints and distributes the WEGLD token, in equal amount to the amount of EGLD locked in the contract. 6 | 7 | There are such contracts deployed in each shard. 8 | -------------------------------------------------------------------------------- /contracts/wegld-swap/meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "multiversx-wegld-swap-sc-meta" 3 | version = "0.0.0" 4 | authors = ["Dorin Iancu "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dev-dependencies] 9 | 10 | [dependencies.multiversx-wegld-swap-sc] 11 | path = ".." 12 | 13 | [dependencies.multiversx-sc] 14 | version = "0.57.1" 15 | 16 | [dependencies.multiversx-sc-meta-lib] 17 | version = "0.57.1" 18 | default-features = false 19 | -------------------------------------------------------------------------------- /contracts/wegld-swap/meta/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | multiversx_sc_meta_lib::cli_main::(); 3 | } 4 | -------------------------------------------------------------------------------- /contracts/wegld-swap/multiversx.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "rust" 3 | } -------------------------------------------------------------------------------- /contracts/wegld-swap/sc-config.toml: -------------------------------------------------------------------------------- 1 | [[proxy]] 2 | path = "src/wegld_proxy.rs" 3 | -------------------------------------------------------------------------------- /contracts/wegld-swap/tests/scenario_go_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | ScenarioWorld::vm_go() 5 | } 6 | 7 | #[test] 8 | fn unwrap_egld_go() { 9 | world().run("scenarios/unwrap_egld.scen.json"); 10 | } 11 | 12 | #[test] 13 | fn wrap_egld_go() { 14 | world().run("scenarios/wrap_egld.scen.json"); 15 | } 16 | -------------------------------------------------------------------------------- /contracts/wegld-swap/tests/wegld_swap_scenario_rs_test.rs: -------------------------------------------------------------------------------- 1 | use multiversx_sc_scenario::*; 2 | 3 | fn world() -> ScenarioWorld { 4 | let mut blockchain = ScenarioWorld::new(); 5 | 6 | blockchain.set_current_dir_from_workspace("contracts/wegld-swap"); 7 | blockchain.register_contract( 8 | "mxsc:output/multiversx-wegld-swap-sc.mxsc.json", 9 | multiversx_wegld_swap_sc::ContractBuilder, 10 | ); 11 | blockchain 12 | } 13 | 14 | #[test] 15 | fn unwrap_egld_rs() { 16 | world().run("scenarios/unwrap_egld.scen.json"); 17 | } 18 | 19 | #[test] 20 | fn wrap_egld_rs() { 21 | world().run("scenarios/wrap_egld.scen.json"); 22 | } 23 | -------------------------------------------------------------------------------- /contracts/wegld-swap/wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | # ########################################## 4 | # ############## AUTO-GENERATED ############# 5 | # ########################################## 6 | 7 | [package] 8 | name = "multiversx-wegld-swap-sc-wasm" 9 | version = "0.0.0" 10 | edition = "2021" 11 | publish = false 12 | 13 | [lib] 14 | crate-type = ["cdylib"] 15 | 16 | [profile.release] 17 | codegen-units = 1 18 | opt-level = "z" 19 | lto = true 20 | debug = false 21 | panic = "abort" 22 | overflow-checks = false 23 | 24 | [profile.dev] 25 | panic = "abort" 26 | 27 | [dependencies.multiversx-wegld-swap-sc] 28 | path = ".." 29 | 30 | [dependencies.multiversx-sc-wasm-adapter] 31 | version = "0.57.1" 32 | 33 | [workspace] 34 | members = ["."] 35 | -------------------------------------------------------------------------------- /contracts/wegld-swap/wasm/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Code generated by the multiversx-sc build system. DO NOT EDIT. 2 | 3 | //////////////////////////////////////////////////// 4 | ////////////////// AUTO-GENERATED ////////////////// 5 | //////////////////////////////////////////////////// 6 | 7 | // Init: 1 8 | // Endpoints: 7 9 | // Async Callback (empty): 1 10 | // Total number of exported functions: 9 11 | 12 | #![no_std] 13 | 14 | multiversx_sc_wasm_adapter::allocator!(); 15 | multiversx_sc_wasm_adapter::panic_handler!(); 16 | 17 | multiversx_sc_wasm_adapter::endpoints! { 18 | multiversx_wegld_swap_sc 19 | ( 20 | init => init 21 | wrapEgld => wrap_egld 22 | unwrapEgld => unwrap_egld 23 | getLockedEgldBalance => get_locked_egld_balance 24 | getWrappedEgldTokenId => wrapped_egld_token_id 25 | pause => pause_endpoint 26 | unpause => unpause_endpoint 27 | isPaused => paused_status 28 | ) 29 | } 30 | 31 | multiversx_sc_wasm_adapter::async_callback_empty! {} 32 | -------------------------------------------------------------------------------- /multiversx.workspace.json: -------------------------------------------------------------------------------- 1 | {} --------------------------------------------------------------------------------