alberta-buck-contracts 0.1.0

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.
@@ -0,0 +1 @@
1
+ {}
package/index.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export interface Artifact {
2
+ abi: object[];
3
+ bytecode: string;
4
+ deployedBytecode: string;
5
+ }
6
+
7
+ export interface Compiler {
8
+ solc: string;
9
+ viaIR: boolean;
10
+ optimizer: { enabled?: boolean; runs?: number };
11
+ evmVersion: string;
12
+ commit: string;
13
+ sha256: string;
14
+ /** Third-party contracts a BUCK world also needs, and the package to get them from. */
15
+ external: Record<string, string>;
16
+ }
17
+
18
+ export declare const contracts: Record<string, Artifact>;
19
+ export declare const compiler: Compiler;
20
+ export declare const deployments: Record<string, Record<string, string>>;
21
+ export declare function artifact(name: string): Artifact;
22
+ export default contracts;
package/index.mjs ADDED
@@ -0,0 +1,43 @@
1
+ // alberta-buck-contracts -- compiled ABI + bytecode for the Alberta Buck
2
+ // contracts, for any EVM: anvil, Tevm in a browser, a testnet.
3
+ //
4
+ // Nothing here is deployed at a fixed address. Every BUCK world deploys
5
+ // fresh and learns its addresses from the receipts, so what this package
6
+ // ships is (abi, bytecode) pairs -- not a deployment registry. The
7
+ // deployments export exists so that publishing real addresses later is not
8
+ // a breaking change to the package's shape.
9
+
10
+ import contractsJson from "./contracts.json" with { type: "json" };
11
+ import compilerJson from "./compiler.json" with { type: "json" };
12
+ import deploymentsJson from "./deployments.json" with { type: "json" };
13
+
14
+ /** Every published contract, keyed by name: { abi, bytecode, deployedBytecode }. */
15
+ export const contracts = contractsJson.contracts;
16
+
17
+ /** Build provenance: solc version, optimizer settings, git commit, bundle sha256. */
18
+ export const compiler = compilerJson;
19
+
20
+ /** Known deployments by chain id. Empty: BUCK worlds deploy their own. */
21
+ export const deployments = deploymentsJson;
22
+
23
+ /**
24
+ * One contract's artifact, by name.
25
+ * @param {string} name e.g. "Buck", "BuckCredit", "IdentityRegistry"
26
+ * @returns {{abi: object[], bytecode: string, deployedBytecode: string}}
27
+ */
28
+ export function artifact(name) {
29
+ const a = contracts[name];
30
+ if (!a) {
31
+ const known = Object.keys(contracts).join(", ");
32
+ const external = compilerJson.external?.[name];
33
+ if (external) {
34
+ throw new Error(
35
+ `${name} is not published here -- it is a third-party contract. ` +
36
+ `Install ${external} and take it from there.`);
37
+ }
38
+ throw new Error(`unknown contract ${name}; this package ships: ${known}`);
39
+ }
40
+ return a;
41
+ }
42
+
43
+ export default contracts;
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "alberta-buck-contracts",
3
+ "version": "0.1.0",
4
+ "description": "Compiled ABI and bytecode for the Alberta Buck contracts (unaudited prototype): the BUCK token, BuckCredit, the BUCK_K controller, the identity registry and the baskets, built with a pinned compiler",
5
+ "type": "module",
6
+ "license": "GPL-3.0-or-later",
7
+ "author": "Perry Kundert <perry@dominionrnd.com>",
8
+ "homepage": "https://github.com/alberta-buck/alberta-buck",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/alberta-buck/alberta-buck.git",
12
+ "directory": "core/contracts"
13
+ },
14
+ "bugs": "https://github.com/alberta-buck/alberta-buck/issues",
15
+ "keywords": [
16
+ "ethereum",
17
+ "solidity",
18
+ "abi",
19
+ "stablecoin",
20
+ "artifacts"
21
+ ],
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "//files": "contracts.json and compiler.json are generated by scripts/contracts-dist.py and therefore gitignored; npm falls back to .gitignore without an .npmignore, so they must be listed here or the tarball ships no bytecode.",
26
+ "files": [
27
+ "index.mjs",
28
+ "index.d.ts",
29
+ "contracts.json",
30
+ "compiler.json",
31
+ "deployments.json",
32
+ "README.md"
33
+ ],
34
+ "main": "./index.mjs",
35
+ "types": "./index.d.ts",
36
+ "exports": {
37
+ ".": "./index.mjs",
38
+ "./contracts.json": "./contracts.json",
39
+ "./compiler.json": "./compiler.json",
40
+ "./deployments.json": "./deployments.json",
41
+ "./package.json": "./package.json"
42
+ }
43
+ }