Skip to content

Feature: Add support for pre-deployed smart contracts #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export async function main(): Promise<void> {
type: "string",
demandOption: true,
default: "{}",
describe: "JSON format of the prefunded accounts {'address': { balance: '100000'}}",
describe: "JSON format of the prefunded accounts {'address': { 'balance': '100000', 'code': '60808060405...', 'storage': { '0x0000000000000000000000000000000000000000000000000000000000000001': '0x000040' }}}",
},
noOutputTimestamp: {
type: "boolean",
Expand Down
4 changes: 4 additions & 0 deletions src/lib/genesisGenerate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export function createBesuGenesis(
Object.entries(prefundedAccounts).forEach(([key, value]) => {
besu.alloc[key] = {
balance: value.balance,
code: value.code,
storage: value.storage,
};
});
}
Expand Down Expand Up @@ -165,6 +167,8 @@ export function createGoQuorumGenesis(
Object.entries(prefundedAccounts).forEach(([key, value]) => {
goquorum.alloc[key] = {
balance: value.balance,
code: value.code,
storage: value.storage,
};
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/questions/commonQs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const genesisNodeAllocationQuestion: QuestionTree = {
export const prefundedAccountsQuestion: QuestionTree = {
name: "prefundedAccounts",
prompt:
"Include JSON format of the prefunded account {'address': { 'balance': '100000'}}: (default {})",
"Include JSON format of the prefunded account {'address': { 'balance': '100000', 'code': '60808060405...', 'storage': { '0x0000000000000000000000000000000000000000000000000000000000000001': '0x000040' }}}: (default {})",
};

export const accountPasswordQuestion: QuestionTree = {
Expand Down
4 changes: 4 additions & 0 deletions src/types/genesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export type GenesisConfig = {

export type Alloc = {
balance: string;
code?: string;
storage?: {
[id: string]: string;
};
comment?: string;
privateKey?: string;
};
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/testConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const TEST_QUORUM_CONFIG: QuorumConfig = {
tesseraPassword: "",
quickstartDevAccounts: false,
noOutputTimestamp: false,
prefundedAccounts: "{}",
prefundedAccounts: '{"0x000000000000000000000000000000000000000A": {"balance": 1000, "code": "060680880", "storage": "0x000001"}}',
genesisNodeAllocation: "100",
};

Expand Down