How do I call functions in Move?

123 Views Asked by At

I currently have this function

public entry fun create_game(
        account: &signer,
        prize_pool_amount: u64,
        player_one_address: address,
        player_two_address: address
    ) acquires State {
        // TODO: Call `check_is_state_exists` function

        // TODO: Call `check_if_signer_is_contract_deployer` function

        // TODO: Call `check_if_signer_has_enough_apt_coins` function

        // TODO: Call `get_next_game_id` function

        // TODO: Create a new instance of Game

        // TODO: Add the game to the State's games SimpleMap instance

        // TODO: Transfer `prize_pool_amount` amount of APT from `account` to the resource account

        // TODO: Emit `CreateGameEvent` event
    }

And I need to call a handful of other functions. I was wondering how I do so?

I tried searching through the documentation but couldnt find any answers

1

There are 1 best solutions below

0
On

Your function can be called by other functions in the move code. eg. test functions.

As your function is an entry function, it can also be called directly (e.g. in transaction. You have multiple options. If the package is deployed, you can call the package - module - function using

  • Aptos CLI
  • via an SDK (Typescript, Rust, ...)
  • via the explorer.aptoslabs.com example