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

lesson-2 no longer compile #6

Open
richard5334 opened this issue Jul 26, 2023 · 0 comments
Open

lesson-2 no longer compile #6

richard5334 opened this issue Jul 26, 2023 · 0 comments

Comments

@richard5334
Copy link

Dear Encode,

    public entry fun collect_profits(_: &ShopOwnerCap, shop: &mut CarShop, ctx: &mut TxContext) {
        let amount = balance::value(&shop.balance);
        let profits = coin::take(&mut shop.balance, amount, ctx);

        transfer::transfer(profits, tx_context::sender(ctx))
    }

in car_shop.move cause the following error:

Error executing ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: SuiMoveVerificationError, source: Some("0000000000000000000000000000000000000000000000000000000000000000::car_shop::collect_profits. Invalid call to '0000000000000000000000000000000000000000000000000000000000000002::transfer::transfer' on an object of type '0x2::coin::Coin<0x2::sui::SUI>'. The transferred object's type must be defined in the current module. If the object has the 'store' type ability, you can use the non-internal variant instead, i.e. 0000000000000000000000000000000000000000000000000000000000000002::transfer::public_transfer'"), command: None } }

Commenting the code allows it to compile. Im unsure as to what would be the fix as I'm still a beginner!

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

No branches or pull requests

1 participant