Skip to content

Commit

Permalink
fix(configuration-generator): premine distribution (#819)
Browse files Browse the repository at this point in the history
* deserialize value as bigint

* Empty commit

* fix premine distribution

* Empty commit

* style: resolve style guide violations

---------

Co-authored-by: sebastijankuzner <[email protected]>
  • Loading branch information
oXtxNt9U and sebastijankuzner authored Jan 14, 2025
1 parent 42ad582 commit 14e3a01
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
7 changes: 6 additions & 1 deletion packages/configuration-generator/bin/create-genesis-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import envPaths from "env-paths";
import path from "path";
import { Identifiers as AppIdentifiers } from "@mainsail/contracts";
import { makeApplication } from "../distribution/application-factory.js";
import { Identifiers } from "../distribution/identifiers.js";

Expand All @@ -16,11 +17,15 @@ async function run() {
symbol: "TѦ",
token: "ARK",
distribute: true,
premine: "12499999999999969",
premine: "125000000000000000000000000",
// snapshot: {
// path: "../../snapshot-19a87c96dbe8ad1be06d33e97cd17f5662eb952c29efd3d8bb00c9c75e7582bc.json",
// },
});

for (const tag of ["evm", "ephemeral"]) {
await app.getTagged(AppIdentifiers.Evm.Instance, "instance", tag).dispose();
}
}

run();
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ export class ConfigurationGenerator {
}

let logger: Contracts.Kernel.Logger | undefined;
if (this.app.isBound(InternalIdentifiers.LogService)) {
logger = this.app.get<Contracts.Kernel.Logger>(InternalIdentifiers.LogService);
if (this.app.isBound(Identifiers.Services.Log.Service)) {
logger = this.app.get<Contracts.Kernel.Logger>(Identifiers.Services.Log.Service);
}

for (const task of tasks) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export class GenesisBlockGenerator extends Generator {
options.pubKeyHash,
)),
);

options.premine = transactions
.reduce((accumulator, current) => accumulator.plus(current.data.value), BigNumber.ZERO)
.toFixed();
} else {
transactions = transactions.concat(
await this.#createTransferTransaction(
Expand Down
1 change: 0 additions & 1 deletion packages/configuration-generator/source/identifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ export const Identifiers = {
Peers: Symbol.for("Generator<Peers>"),
Wallet: Symbol.for("Generator<Wallet>"),
},
LogService: Symbol.for("Configuration<Logger>"),
};

0 comments on commit 14e3a01

Please sign in to comment.