Skip to content

Commit

Permalink
Merge pull request #2349 from planetarium/PDX-204
Browse files Browse the repository at this point in the history
PDX-204: Add GetAdditionalActionBases to genesis cli command
  • Loading branch information
moreal authored Dec 12, 2023
2 parents b2104a0 + da19908 commit 45e2cef
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
17 changes: 15 additions & 2 deletions NineChronicles.Headless.Executable/Commands/GenesisCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ out List<CreatePledge> pledgeActions
[Command(Description = "Mine a new genesis block")]
public void Mine(
[Argument("CONFIG", Description = "JSON config path to mine genesis block")]
string configPath)
string configPath = "./config.json")
{
var options = new JsonSerializerOptions
{
Expand Down Expand Up @@ -275,7 +275,7 @@ public void Mine(
initialValidators: initialValidatorSet.ToDictionary(
item => new PublicKey(ByteUtil.ParseHex(item.PublicKey)),
item => new BigInteger(item.Power)),
actionBases: adminMeads.Concat(initialMeads).Concat(initialPledges),
actionBases: adminMeads.Concat(initialMeads).Concat(initialPledges).Concat(GetAdditionalActionBases()),
goldCurrency: currency
);

Expand Down Expand Up @@ -320,6 +320,19 @@ public void Mine(
}
}

/// <summary>
/// Actions to be appended on end of transaction actions.
/// You can add actions code to this method before generate genesis block.
/// </summary>
/// <returns></returns>
private static List<ActionBase> GetAdditionalActionBases()
{
return new List<ActionBase>
{

};
}

#pragma warning disable S3459
/// <summary>
/// Game data to set into genesis block.
Expand Down
22 changes: 17 additions & 5 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,28 @@
"properties": {
"data": {
"type": "object",
"description": "Game data to set into genesis block.",
"properties": {
"tablePath": {
"type": "string"
"type": "string",
"description": "A Path of game data table directory."
}
}
},
"currency": {
"type": "object",
"description": "Currency related configurations. Set initial minter(Tx signer) and/or initial currency depositions. If not provided, default values will set.",
"properties": {
"allowMint": {
"type": "boolean"
},
"initialMinter": {
"type": "string"
"type": "string",
"description": "Private Key of initial currency minter. If not provided, a new private key will be created and used."
},
"initialCurrencyDeposit": {
"type": "array",
"description": "Initial currency deposition list. If you leave it empty list or even not provide, the `InitialMinter` will get 10000 currency. You can see newly created deposition info in `initial_deposit.csv` file",
"items": {
"type": "object",
"properties": {
Expand All @@ -42,15 +50,19 @@
},
"admin": {
"type": "object",
"description": "Admin related configurations. If not provided, no admin will be set.",
"properties": {
"activate": {
"type": "boolean"
"type": "boolean",
"description": "Whether active admin address or not."
},
"address": {
"type": "string"
"type": "string",
"description": "Address to give admin privilege. If `Activate` is `true` and no `address` provided, the minter will get admin privilege."
},
"validUntil": {
"type": "integer"
"type": "integer",
"description": "The block count to persist admin privilege. After this block, admin will no longer be admin."
}
}
},
Expand Down

0 comments on commit 45e2cef

Please sign in to comment.