Joystream / joystream

Joystream Monorepo
http://www.joystream.org
GNU General Public License v3.0
1.42k stars 115 forks source link

Existential deposit module for project token account #4936

Closed ignazio-bovo closed 11 months ago

ignazio-bovo commented 11 months ago

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 by Unito

bedeho commented 11 months ago

Great work.