Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

game sc tests #31

Merged
merged 5 commits into from
Oct 9, 2023
Merged

game sc tests #31

merged 5 commits into from
Oct 9, 2023

Conversation

mihaicalinluca
Copy link
Contributor

No description provided.

@github-actions
Copy link

github-actions bot commented Oct 6, 2023

Contract comparison - from 428c8db to d1d9f14

Path                                                                                             size                  has-allocator                     has-format
mx-contracts-rs/contracts
- adder/adder.wasm 685 No No
- bonding-curve-contract/bonding-curve-contract.wasm 15606 No No
- check-pause/check-pause.wasm 1227 No No
- crowdfunding-esdt/crowdfunding-esdt.wasm 3612 No No
- crypto-bubbles/crypto-bubbles.wasm 2364 No No
- crypto-zombies/crypto-zombies.wasm 11131 No No
- digital-cash/digital-cash.wasm 7370 No No
- empty/empty.wasm 232 No No
- esdt-transfer-with-fee/esdt-transfer-with-fee.wasm 9094 No No
- factorial/factorial.wasm 567 No No
- fractional-nfts/fractional-nfts.wasm 8712 No No
- liquid-locking/liquid-locking.wasm 10239 No No
- lottery-esdt/lottery-esdt.wasm 11385 No No
- multisig
- - multisig.wasm 15306 No No
- - multisig-full.wasm 17310 No No
- - multisig-view.wasm 7699 No No
- mvx-game-sc/mvx-game-sc.wasm 10169 ➡️ 10170 🔴 No No
- mystery-box/mystery-box.wasm 13804 No No
- nft-escrow/nft-escrow.wasm 7327 No No
- nft-minter/nft-minter.wasm 10210 No No
- nft-storage-prepay/nft-storage-prepay.wasm 2293 No No
- paymaster/paymaster.wasm 7045 No No
- ping-pong-egld/ping-pong-egld.wasm 6696 No No
- price-aggregator/multiversx-price-aggregator-sc.wasm 20328 No No
- proxy-pause/proxy-pause.wasm 5753 No No
- rewards-distribution/rewards-distribution.wasm 11259 No No
- seed-nft-minter/seed-nft-minter.wasm 15343 No No
- token-release/token-release.wasm 8466 No No
- wegld-swap/multiversx-wegld-swap-sc.wasm 4382 No No
mx-contracts-rs/contracts/crypto-kitties
- kitty-auction/kitty-auction.wasm 11132 No No
- kitty-genetic-alg/kitty-genetic-alg.wasm 3584 No No
- kitty-ownership/kitty-ownership.wasm 14005 No No
mx-contracts-rs/contracts/order-book
- factory/order-book-factory.wasm 4995 No No
- pair/order-book-pair.wasm 16426 No No

alyn509
alyn509 previously approved these changes Oct 6, 2023
@@ -35,7 +35,7 @@ pub trait OwnerModule: crate::private::PrivateModule + crate::storage::StorageMo

for (winner, percentage) in val.into_iter() {
let reward_per_winner =
&BigUint::from(percentage) * &total_wager / &BigUint::from(100u64);
&BigUint::from(percentage) * &total_wager / &BigUint::from(10000u64);
Copy link
Contributor

Choose a reason for hiding this comment

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

Rust accepts _ character in integers, so best practice are:

  • 10_000u64
  • declare a constant with an intuitive name

.put_account(
USER3_ADDR,
Account::new()
.nonce(4)
Copy link
Contributor

Choose a reason for hiding this comment

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

Starting nonces should be 1 for each account so you can more easily compute nonces with executed transactions.

caller: &str,
game_sc: &mut ContractInfo<mvx_game_sc::Proxy<StaticApi>>,
) -> &mut Self {
self.world.sc_call(
ScCallStep::new()
.from(caller)
.to(GAME_SC_ADDR)
.esdt_transfer(TOKEN_ID, 0u64, BigUint::from(STARTING_FEE))
.esdt_transfer(TOKEN_ID, 0u64, BigUint::<StaticApi>::from(STARTING_FEE))
Copy link
Contributor

Choose a reason for hiding this comment

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

I thinkg BigUint::from(STARTING_FEE) should be enough. Check for the imported BigUint (because there are 2).
You should use multiversx_sc_scenario::num_bigint::BigUint.

@mihaicalinluca mihaicalinluca merged commit 38ce1b3 into main Oct 9, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants