diff --git a/node/src/chainspec/mainnet.rs b/node/src/chainspec/mainnet.rs index 547066202..92e89bc68 100644 --- a/node/src/chainspec/mainnet.rs +++ b/node/src/chainspec/mainnet.rs @@ -94,6 +94,8 @@ pub fn local_mainnet_config(chain_id: u64) -> Result { properties.insert("tokenDecimals".into(), 18u32.into()); properties.insert("ss58Format".into(), tangle_primitives::MAINNET_SS58_PREFIX.into()); + let endowment: Balance = 10_000_000 * UNIT; + Ok(ChainSpec::from_genesis( "Local Tangle Mainnet", "local-tangle-mainnet", @@ -109,12 +111,12 @@ pub fn local_mainnet_config(chain_id: u64) -> Result { ], // Endowed accounts vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), + (get_account_id_from_seed::("Alice"), endowment), + (get_account_id_from_seed::("Bob"), endowment), + (get_account_id_from_seed::("Charlie"), endowment), + (get_account_id_from_seed::("Alice//stash"), endowment), + (get_account_id_from_seed::("Bob//stash"), endowment), + (get_account_id_from_seed::("Charlie//stash"), endowment), ], // Sudo account get_account_id_from_seed::("Alice"), @@ -166,7 +168,7 @@ pub fn tangle_mainnet_config(chain_id: u64) -> Result { // Initial validators get_initial_authorities(), // Endowed accounts - vec![], + vec![mainnet::get_treasury_balance(), mainnet::get_foundation_balance()], // Sudo account get_root_key(), // EVM chain ID @@ -204,13 +206,12 @@ pub fn tangle_mainnet_config(chain_id: u64) -> Result { fn mainnet_genesis( wasm_binary: &[u8], initial_authorities: Vec<(AccountId, BabeId, GrandpaId, ImOnlineId)>, - endowed_accounts: Vec, + endowed_accounts: Vec<(AccountId, Balance)>, root_key: AccountId, chain_id: u64, genesis_airdrop: DistributionResult, genesis_non_airdrop: Vec<(MultiAddress, u128, u64, u64, u128)>, ) -> RuntimeGenesisConfig { - const ENDOWMENT: Balance = 10_000_000 * UNIT; // stakers: all validators and nominators. let stakers = initial_authorities .iter() @@ -242,7 +243,7 @@ fn mainnet_genesis( balances: genesis_non_airdrop .iter() .map(|(x, y, _, _, _)| (x.clone().to_account_id_32(), *y)) - .chain(endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT))) + .chain(endowed_accounts.into_iter()) .collect(), }, vesting: VestingConfig { diff --git a/node/src/distributions/data/webb_investor_distributions.json b/node/src/distributions/data/webb_investor_distributions.json new file mode 100644 index 000000000..8128f3183 --- /dev/null +++ b/node/src/distributions/data/webb_investor_distributions.json @@ -0,0 +1,4 @@ +{ + "5FTwaz65zTMaBcW6vddcmSuyJR4paQkw8w7ZKPMGr4bWrwpj": 1000000000000000, + "5CX31Aw4yEF4sSgr65WQDMCBn97f3K98VL4kMq64aBt3HFu7": 1000000000000000 +} \ No newline at end of file diff --git a/node/src/distributions/data/webb_team_distributions.json b/node/src/distributions/data/webb_team_distributions.json new file mode 100644 index 000000000..8128f3183 --- /dev/null +++ b/node/src/distributions/data/webb_team_distributions.json @@ -0,0 +1,4 @@ +{ + "5FTwaz65zTMaBcW6vddcmSuyJR4paQkw8w7ZKPMGr4bWrwpj": 1000000000000000, + "5CX31Aw4yEF4sSgr65WQDMCBn97f3K98VL4kMq64aBt3HFu7": 1000000000000000 +} \ No newline at end of file diff --git a/node/src/distributions/mainnet.rs b/node/src/distributions/mainnet.rs index 5526e3238..9bf0ae17f 100644 --- a/node/src/distributions/mainnet.rs +++ b/node/src/distributions/mainnet.rs @@ -14,15 +14,13 @@ // // You should have received a copy of the GNU General Public License // along with Tangle. If not, see . -use std::str::FromStr; -use tangle_primitives::types::BlockNumber; -use tangle_runtime::UNIT; - use super::testnet::{get_git_root, read_contents, read_contents_to_evm_accounts}; use pallet_airdrop_claims::{EthereumAddress, MultiAddress, StatementKind}; use sp_core::H160; -use sp_runtime::AccountId32; -use std::collections::BTreeMap; +use sp_runtime::{traits::AccountIdConversion, AccountId32}; +use std::{collections::BTreeMap, str::FromStr}; +use tangle_primitives::types::BlockNumber; +use tangle_runtime::UNIT; use tangle_testnet_runtime::{AccountId, Balance, ExistentialDeposit}; /// The contents of the file should be a map of accounts to balances. @@ -68,6 +66,16 @@ fn get_edgeware_snapshot_list() -> BTreeMap { ) } +fn get_team_balance_distribution_list() -> BTreeMap { + read_contents_to_substrate_accounts("node/src/distributions/data/webb_team_distribution.json") +} + +fn get_investor_balance_distribution_list() -> BTreeMap { + read_contents_to_substrate_accounts( + "node/src/distributions/data/webb_investor_distribution.json", + ) +} + pub fn get_discord_list() -> Vec { read_contents_to_evm_accounts("node/src/distributions/data/discord_evm_addresses.json") } @@ -178,17 +186,34 @@ pub fn get_substrate_balance_distribution() -> DistributionResult { } pub fn get_investor_balance_distribution() -> Vec<(MultiAddress, u128, u64, u64, u128)> { - // TODO : Read from actual investor file - let investor_accounts: Vec<(MultiAddress, u128)> = vec![]; + let investor_accounts: Vec<(MultiAddress, u128)> = get_investor_balance_distribution_list() + .into_iter() + .map(|(address, balance)| (MultiAddress::Native(address), balance as u128)) + .collect(); compute_balance_distribution_with_cliff_and_vesting(investor_accounts) } pub fn get_team_balance_distribution() -> Vec<(MultiAddress, u128, u64, u64, u128)> { - // TODO : Read from actual team file - let team_accounts: Vec<(MultiAddress, u128)> = vec![]; + let team_accounts: Vec<(MultiAddress, u128)> = get_team_balance_distribution_list() + .into_iter() + .map(|(address, balance)| (MultiAddress::Native(address), balance as u128)) + .collect(); compute_balance_distribution_with_cliff_and_vesting(team_accounts) } +pub fn get_treasury_balance() -> (AccountId, u128) { + let pallet_id = tangle_primitives::treasury::TREASURY_PALLET_ID; + let acc: AccountId = pallet_id.into_account_truncating(); + (acc, UNIT * 100_000) +} + +pub fn get_foundation_balance() -> (AccountId, u128) { + // TODO : Setup foundation account here + let pallet_id = tangle_primitives::treasury::TREASURY_PALLET_ID; + let acc: AccountId = pallet_id.into_account_truncating(); + (acc, UNIT * 100_000) +} + pub fn compute_balance_distribution_with_cliff_and_vesting( investor_accounts: Vec<(MultiAddress, u128)>, ) -> Vec<(MultiAddress, u128, u64, u64, u128)> {