abc-blockchain 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/PUBLISHING.md +89 -0
  3. package/README.md +144 -0
  4. package/SECURITY.md +41 -0
  5. package/dist/branding.d.ts +7 -0
  6. package/dist/branding.js +14 -0
  7. package/dist/cli.d.ts +2 -0
  8. package/dist/cli.js +31 -0
  9. package/dist/config.d.ts +22 -0
  10. package/dist/config.js +15 -0
  11. package/dist/create-project.d.ts +3 -0
  12. package/dist/create-project.js +55 -0
  13. package/dist/create-project.test.d.ts +1 -0
  14. package/dist/create-project.test.js +29 -0
  15. package/dist/logger.d.ts +7 -0
  16. package/dist/logger.js +15 -0
  17. package/dist/package-manager.d.ts +3 -0
  18. package/dist/package-manager.js +14 -0
  19. package/dist/template.d.ts +3 -0
  20. package/dist/template.js +30 -0
  21. package/package.json +72 -0
  22. package/templates/hardhat-erc4337/.env.example +7 -0
  23. package/templates/hardhat-erc4337/.eslintrc.cjs +14 -0
  24. package/templates/hardhat-erc4337/.github/workflows/ci.yml +36 -0
  25. package/templates/hardhat-erc4337/.github/workflows/release.yml +26 -0
  26. package/templates/hardhat-erc4337/.husky/pre-commit +1 -0
  27. package/templates/hardhat-erc4337/.prettierrc.json +7 -0
  28. package/templates/hardhat-erc4337/README.md.tmpl +98 -0
  29. package/templates/hardhat-erc4337/contracts/AccountFactory.sol +45 -0
  30. package/templates/hardhat-erc4337/contracts/EntryPoint.sol +69 -0
  31. package/templates/hardhat-erc4337/contracts/SmartAccount.sol +93 -0
  32. package/templates/hardhat-erc4337/contracts/Token.sol +15 -0
  33. package/templates/hardhat-erc4337/contracts/interfaces/IEntryPoint.sol +24 -0
  34. package/templates/hardhat-erc4337/contracts/interfaces/IPaymasterHook.sol +12 -0
  35. package/templates/hardhat-erc4337/deployments/.gitkeep +1 -0
  36. package/templates/hardhat-erc4337/hardhat.config.ts +41 -0
  37. package/templates/hardhat-erc4337/ignition/modules/AccountAbstraction.ts +14 -0
  38. package/templates/hardhat-erc4337/package.json.tmpl +62 -0
  39. package/templates/hardhat-erc4337/scripts/createAccount.ts +33 -0
  40. package/templates/hardhat-erc4337/scripts/deploy.ts +50 -0
  41. package/templates/hardhat-erc4337/scripts/lib/bundler.ts +17 -0
  42. package/templates/hardhat-erc4337/scripts/lib/env.ts +18 -0
  43. package/templates/hardhat-erc4337/scripts/lib/logger.ts +8 -0
  44. package/templates/hardhat-erc4337/slither.config.json +4 -0
  45. package/templates/hardhat-erc4337/tasks/accounts.ts +17 -0
  46. package/templates/hardhat-erc4337/test/SmartAccount.ts +32 -0
  47. package/templates/hardhat-erc4337/tsconfig.json +15 -0
@@ -0,0 +1,8 @@
1
+ export const log = {
2
+ info(message: string, context: Record<string, unknown> = {}) {
3
+ console.log(JSON.stringify({ level: "info", message, ...context }));
4
+ },
5
+ error(message: string, context: Record<string, unknown> = {}) {
6
+ console.error(JSON.stringify({ level: "error", message, ...context }));
7
+ }
8
+ };
@@ -0,0 +1,4 @@
1
+ {
2
+ "filter_paths": "node_modules|artifacts|cache|typechain-types",
3
+ "solc_remaps": ["@openzeppelin=node_modules/@openzeppelin"]
4
+ }
@@ -0,0 +1,17 @@
1
+ import { task } from "hardhat/config";
2
+
3
+ const accountsTask = task("accounts", "Prints configured signer accounts")
4
+ .setInlineAction(async (_args, hre) => {
5
+ const connection = await hre.network.create();
6
+ const { ethers } = connection;
7
+ const accounts = await ethers.getSigners();
8
+
9
+ for (const account of accounts) {
10
+ console.log(account.address);
11
+ }
12
+
13
+ await connection.close();
14
+ })
15
+ .build();
16
+
17
+ export default accountsTask;
@@ -0,0 +1,32 @@
1
+ import { expect } from "chai";
2
+ import { network } from "hardhat";
3
+
4
+ describe("ABC Blockchain ERC-4337 template", function () {
5
+ it("deploys deterministic smart accounts through the factory", async function () {
6
+ const connection = await network.create();
7
+ const { ethers } = connection;
8
+ const [owner] = await ethers.getSigners();
9
+ const EntryPoint = await ethers.getContractFactory("EntryPoint");
10
+ const entryPoint = await EntryPoint.deploy();
11
+
12
+ const Factory = await ethers.getContractFactory("AccountFactory");
13
+ const factory = await Factory.deploy(await entryPoint.getAddress());
14
+
15
+ const salt = 42n;
16
+ const predicted = await factory.getAccountAddress(owner.address, salt);
17
+ await factory.createAccount(owner.address, salt);
18
+ expect(await ethers.provider.getCode(predicted)).to.not.equal("0x");
19
+ await connection.close();
20
+ });
21
+
22
+ it("deploys the sample token with owner supply", async function () {
23
+ const connection = await network.create();
24
+ const { ethers } = connection;
25
+ const [owner] = await ethers.getSigners();
26
+ const Token = await ethers.getContractFactory("Token");
27
+ const token = await Token.deploy(owner.address);
28
+
29
+ expect(await token.balanceOf(owner.address)).to.equal(1_000_000n * 10n ** 18n);
30
+ await connection.close();
31
+ });
32
+ });
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "resolveJsonModule": true,
10
+ "skipLibCheck": true,
11
+ "types": ["node", "mocha"],
12
+ "noEmit": true
13
+ },
14
+ "include": ["./hardhat.config.ts", "./scripts", "./tasks", "./test"]
15
+ }