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

Existential deposit module for project token account #4936

Closed
ignazio-bovo opened this issue Oct 18, 2023 · 1 comment
Closed

Existential deposit module for project token account #4936

ignazio-bovo opened this issue Oct 18, 2023 · 1 comment

Comments

@ignazio-bovo
Copy link
Contributor

ignazio-bovo commented Oct 18, 2023

Goal: bring to attention the existential deposit for the module account project token
Running the following snippet

        #[cfg(feature = "try-runtime")]
        fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
            let onchain = Pallet::<T>::on_chain_storage_version();

            ensure!(onchain < 1, "this migration can be deleted");

            let module_account_id = Module::<T>::module_treasury_account();
            let treasury_free_balance = Joy::<T>::free_balance(&module_account_id);

            log!(
                info,
                "treasury_free_balance pre migration: {:?}",
                treasury_free_balance
            );

            log!(
                info,
                "existential deposit: {:?}",
                T::JoyExistentialDeposit::get()
            );

            ensure!(
                treasury_free_balance.is_zero(),
                "module treasury account is not zero"
            );

            ensure!(
                treasury_free_balance.is_zero(),
                "module treasury account is not zero"
            );
            Ok(vec![])
        }
        ```
Produces the following result against live mainnet

Oct 18 10:36:32.785 INFO runtime::project_token: [4491309] 📹 treasury_free_balance pre migration: 266666560
Oct 18 10:36:32.785 INFO runtime::project_token: [4491309] 📹 existential deposit: 266666560

Hence the account is already pre-loaded with the existential deposit

┆Issue is synchronized with this [Asana task](https://app.asana.com/0/1204404358291458/1205746713035377) by [Unito](https://www.unito.io)
@bedeho
Copy link
Member

bedeho commented Oct 18, 2023

Great work.

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

2 participants