Skip to content

Commit bc2a69d

Browse files
authored
[Test] add token distribution in hersir settings (#3833)
* add token distribution in settings * move create account fragment before token distribution
1 parent afc8c39 commit bc2a69d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

testing/hersir/src/builder/settings.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,9 @@ pub struct NodeSetting {
5252
#[derive(Debug, Clone)]
5353
pub struct Settings {
5454
pub nodes: HashMap<NodeAlias, NodeSetting>,
55-
5655
pub wallets: HashMap<WalletAlias, Wallet>,
57-
5856
pub block0: Block0Configuration,
59-
6057
pub stake_pools: HashMap<NodeAlias, StakePool>,
61-
6258
pub vote_plans: HashMap<VotePlanKey, VotePlanSettings>,
6359
}
6460

@@ -208,14 +204,27 @@ impl Settings {
208204

209205
// TODO add support for sharing fragment with multiple utxos
210206
let initial_fragment = Initial::Fund(vec![InitialUTxO {
211-
address: initial_address,
207+
address: initial_address.clone(),
212208
value: (*wallet_template.value()).into(),
213209
}]);
214210

215211
self.wallets
216212
.insert(wallet_template.alias().clone(), wallet.clone());
217213
self.block0.initial.push(initial_fragment);
218214

215+
for (token_identifier, value) in wallet_template.tokens() {
216+
let tokens_fragment = Initial::Token(InitialToken {
217+
token_id: token_identifier.clone(),
218+
// TODO: there are no policies now, but this will need to be changed later
219+
policy: MintingPolicy::new().into(),
220+
to: vec![Destination {
221+
address: initial_address.clone(),
222+
value: (*value).into(),
223+
}],
224+
});
225+
self.block0.initial.push(tokens_fragment);
226+
}
227+
219228
if let Some(delegation) = wallet_template.delegate() {
220229
use chain_impl_mockchain::certificate::PoolId as StakePoolId;
221230

0 commit comments

Comments
 (0)