@aztec/protocol-contracts 0.0.0-test.0 → 0.0.1-commit.001888fc
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.
- package/README.md +2 -2
- package/artifacts/AuthRegistry.json +2602 -1590
- package/artifacts/ContractClassRegistry.json +2022 -0
- package/artifacts/ContractInstanceRegistry.json +2949 -0
- package/artifacts/FeeJuice.json +3040 -2987
- package/artifacts/MultiCallEntrypoint.json +2153 -1169
- package/artifacts/PublicChecks.json +1200 -0
- package/dest/auth-registry/index.d.ts +3 -2
- package/dest/auth-registry/index.d.ts.map +1 -1
- package/dest/auth-registry/index.js +4 -4
- package/dest/auth-registry/lazy.d.ts +1 -1
- package/dest/auth-registry/lazy.js +5 -5
- package/dest/class-registry/contract_class_published_event.d.ts +17 -0
- package/dest/class-registry/contract_class_published_event.d.ts.map +1 -0
- package/dest/{class-registerer/contract_class_registered_event.js → class-registry/contract_class_published_event.js} +15 -20
- package/dest/class-registry/index.d.ts +8 -0
- package/dest/class-registry/index.d.ts.map +1 -0
- package/dest/class-registry/index.js +17 -0
- package/dest/class-registry/lazy.d.ts +9 -0
- package/dest/class-registry/lazy.d.ts.map +1 -0
- package/dest/class-registry/lazy.js +26 -0
- package/dest/class-registry/private_function_broadcasted_event.d.ts +44 -0
- package/dest/class-registry/private_function_broadcasted_event.d.ts.map +1 -0
- package/dest/{class-registerer → class-registry}/private_function_broadcasted_event.js +11 -11
- package/dest/class-registry/utility_function_broadcasted_event.d.ts +38 -0
- package/dest/class-registry/utility_function_broadcasted_event.d.ts.map +1 -0
- package/dest/{class-registerer/unconstrained_function_broadcasted_event.js → class-registry/utility_function_broadcasted_event.js} +20 -20
- package/dest/fee-juice/index.d.ts +2 -2
- package/dest/fee-juice/index.d.ts.map +1 -1
- package/dest/fee-juice/index.js +4 -4
- package/dest/fee-juice/lazy.d.ts +1 -1
- package/dest/fee-juice/lazy.js +5 -5
- package/dest/index.d.ts +1 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +0 -1
- package/dest/instance-registry/contract_instance_published_event.d.ts +21 -0
- package/dest/instance-registry/contract_instance_published_event.d.ts.map +1 -0
- package/dest/{instance-deployer/contract_instance_deployed_event.js → instance-registry/contract_instance_published_event.js} +9 -6
- package/dest/instance-registry/contract_instance_updated_event.d.ts +17 -0
- package/dest/instance-registry/contract_instance_updated_event.d.ts.map +1 -0
- package/dest/instance-registry/contract_instance_updated_event.js +35 -0
- package/dest/instance-registry/index.d.ts +7 -0
- package/dest/instance-registry/index.d.ts.map +1 -0
- package/dest/instance-registry/index.js +15 -0
- package/dest/instance-registry/lazy.d.ts +8 -0
- package/dest/{instance-deployer → instance-registry}/lazy.d.ts.map +1 -1
- package/dest/instance-registry/lazy.js +25 -0
- package/dest/make_protocol_contract.d.ts +4 -4
- package/dest/make_protocol_contract.d.ts.map +1 -1
- package/dest/make_protocol_contract.js +28 -14
- package/dest/multi-call-entrypoint/index.d.ts +1 -1
- package/dest/multi-call-entrypoint/index.d.ts.map +1 -1
- package/dest/multi-call-entrypoint/index.js +4 -4
- package/dest/multi-call-entrypoint/lazy.d.ts +1 -1
- package/dest/multi-call-entrypoint/lazy.js +5 -5
- package/dest/protocol_contract.d.ts +1 -1
- package/dest/protocol_contract_data.d.ts +26 -16
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +119 -23
- package/dest/provider/bundle.d.ts +1 -1
- package/dest/provider/bundle.d.ts.map +1 -1
- package/dest/provider/bundle.js +7 -7
- package/dest/provider/lazy.d.ts +1 -1
- package/dest/provider/lazy.d.ts.map +1 -1
- package/dest/provider/lazy.js +9 -9
- package/dest/provider/protocol_contracts_provider.d.ts +1 -1
- package/dest/public-checks/index.d.ts +5 -0
- package/dest/public-checks/index.d.ts.map +1 -0
- package/dest/public-checks/index.js +13 -0
- package/dest/public-checks/lazy.d.ts +6 -0
- package/dest/public-checks/lazy.d.ts.map +1 -0
- package/dest/public-checks/lazy.js +23 -0
- package/dest/scripts/cleanup_artifacts.js +2 -2
- package/dest/scripts/generate_data.js +95 -53
- package/dest/tests/fixtures.d.ts +4 -6
- package/dest/tests/fixtures.d.ts.map +1 -1
- package/dest/tests/fixtures.js +6 -6
- package/package.json +23 -20
- package/src/auth-registry/index.ts +6 -6
- package/src/auth-registry/lazy.ts +5 -5
- package/src/class-registry/__snapshots__/README.md +9 -0
- package/src/{class-registerer/contract_class_registered_event.ts → class-registry/contract_class_published_event.ts} +23 -23
- package/src/class-registry/index.ts +23 -0
- package/src/class-registry/lazy.ts +33 -0
- package/src/{class-registerer → class-registry}/private_function_broadcasted_event.ts +13 -9
- package/src/{class-registerer/unconstrained_function_broadcasted_event.ts → class-registry/utility_function_broadcasted_event.ts} +26 -22
- package/src/fee-juice/index.ts +5 -5
- package/src/fee-juice/lazy.ts +5 -5
- package/src/index.ts +0 -1
- package/src/instance-registry/__snapshots__/README.md +9 -0
- package/src/{instance-deployer/contract_instance_deployed_event.ts → instance-registry/contract_instance_published_event.ts} +13 -7
- package/src/{instance-deployer → instance-registry}/contract_instance_updated_event.ts +15 -15
- package/src/instance-registry/index.ts +23 -0
- package/src/instance-registry/lazy.ts +32 -0
- package/src/make_protocol_contract.ts +37 -15
- package/src/multi-call-entrypoint/index.ts +4 -4
- package/src/multi-call-entrypoint/lazy.ts +5 -5
- package/src/protocol_contract_data.ts +97 -23
- package/src/provider/bundle.ts +7 -7
- package/src/provider/lazy.ts +9 -9
- package/src/{router → public-checks}/index.ts +5 -5
- package/src/public-checks/lazy.ts +29 -0
- package/src/tests/fixtures.ts +6 -6
- package/artifacts/ContractClassRegisterer.json +0 -7219
- package/artifacts/ContractInstanceDeployer.json +0 -2984
- package/artifacts/Router.json +0 -3798
- package/dest/build_protocol_contract_tree.d.ts +0 -10
- package/dest/build_protocol_contract_tree.d.ts.map +0 -1
- package/dest/build_protocol_contract_tree.js +0 -20
- package/dest/class-registerer/contract_class_registered_event.d.ts +0 -18
- package/dest/class-registerer/contract_class_registered_event.d.ts.map +0 -1
- package/dest/class-registerer/index.d.ts +0 -8
- package/dest/class-registerer/index.d.ts.map +0 -1
- package/dest/class-registerer/index.js +0 -17
- package/dest/class-registerer/lazy.d.ts +0 -9
- package/dest/class-registerer/lazy.d.ts.map +0 -1
- package/dest/class-registerer/lazy.js +0 -26
- package/dest/class-registerer/private_function_broadcasted_event.d.ts +0 -46
- package/dest/class-registerer/private_function_broadcasted_event.d.ts.map +0 -1
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts +0 -40
- package/dest/class-registerer/unconstrained_function_broadcasted_event.d.ts.map +0 -1
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts +0 -20
- package/dest/instance-deployer/contract_instance_deployed_event.d.ts.map +0 -1
- package/dest/instance-deployer/contract_instance_updated_event.d.ts +0 -16
- package/dest/instance-deployer/contract_instance_updated_event.d.ts.map +0 -1
- package/dest/instance-deployer/contract_instance_updated_event.js +0 -36
- package/dest/instance-deployer/index.d.ts +0 -7
- package/dest/instance-deployer/index.d.ts.map +0 -1
- package/dest/instance-deployer/index.js +0 -15
- package/dest/instance-deployer/lazy.d.ts +0 -8
- package/dest/instance-deployer/lazy.js +0 -25
- package/dest/protocol_contract_tree.d.ts +0 -7
- package/dest/protocol_contract_tree.d.ts.map +0 -1
- package/dest/protocol_contract_tree.js +0 -34
- package/dest/router/index.d.ts +0 -5
- package/dest/router/index.d.ts.map +0 -1
- package/dest/router/index.js +0 -13
- package/dest/router/lazy.d.ts +0 -6
- package/dest/router/lazy.d.ts.map +0 -1
- package/dest/router/lazy.js +0 -23
- package/src/build_protocol_contract_tree.ts +0 -29
- package/src/class-registerer/index.ts +0 -25
- package/src/class-registerer/lazy.ts +0 -33
- package/src/instance-deployer/index.ts +0 -23
- package/src/instance-deployer/lazy.ts +0 -32
- package/src/protocol_contract_tree.ts +0 -44
- package/src/router/lazy.ts +0 -29
- /package/artifacts/{ContractClassRegisterer.d.json.ts → ContractClassRegistry.d.json.ts} +0 -0
- /package/artifacts/{ContractInstanceDeployer.d.json.ts → ContractInstanceRegistry.d.json.ts} +0 -0
- /package/artifacts/{Router.d.json.ts → PublicChecks.d.json.ts} +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { CONTRACT_CLASS_PUBLISHED_MAGIC_VALUE } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
4
|
-
import {
|
|
4
|
+
import { bufferFromFields } from '@aztec/stdlib/abi';
|
|
5
5
|
import {
|
|
6
6
|
type ContractClassPublic,
|
|
7
|
-
type PublicFunction,
|
|
8
7
|
computeContractClassId,
|
|
9
8
|
computePublicBytecodeCommitment,
|
|
10
9
|
} from '@aztec/stdlib/contract';
|
|
11
10
|
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
12
11
|
|
|
13
|
-
import {
|
|
12
|
+
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
14
13
|
|
|
15
|
-
/** Event emitted from the
|
|
16
|
-
export class
|
|
14
|
+
/** Event emitted from the ContractClassRegistry. */
|
|
15
|
+
export class ContractClassPublishedEvent {
|
|
17
16
|
constructor(
|
|
18
17
|
public readonly contractClassId: Fr,
|
|
19
18
|
public readonly version: number,
|
|
@@ -22,19 +21,24 @@ export class ContractClassRegisteredEvent {
|
|
|
22
21
|
public readonly packedPublicBytecode: Buffer,
|
|
23
22
|
) {}
|
|
24
23
|
|
|
25
|
-
static
|
|
26
|
-
return
|
|
24
|
+
static isContractClassPublishedEvent(log: ContractClassLog) {
|
|
25
|
+
return (
|
|
26
|
+
log.contractAddress.equals(ProtocolContractAddress.ContractClassRegistry) &&
|
|
27
|
+
log.fields.fields[0].toBigInt() === CONTRACT_CLASS_PUBLISHED_MAGIC_VALUE
|
|
28
|
+
);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
static fromLog(log: ContractClassLog) {
|
|
30
|
-
|
|
32
|
+
// See how the log is serialized in `noir-projects/noir-contracts/contracts/protocol/contract_class_registry_contract/src/events/class_published.nr`.
|
|
33
|
+
const fieldsWithoutTag = log.fields.fields.slice(1);
|
|
34
|
+
const reader = new FieldReader(fieldsWithoutTag);
|
|
31
35
|
const contractClassId = reader.readField();
|
|
32
36
|
const version = reader.readField().toNumber();
|
|
33
37
|
const artifactHash = reader.readField();
|
|
34
38
|
const privateFunctionsRoot = reader.readField();
|
|
35
|
-
const packedPublicBytecode = bufferFromFields(reader.readFieldArray(
|
|
39
|
+
const packedPublicBytecode = bufferFromFields(reader.readFieldArray(fieldsWithoutTag.length - reader.cursor));
|
|
36
40
|
|
|
37
|
-
return new
|
|
41
|
+
return new ContractClassPublishedEvent(
|
|
38
42
|
contractClassId,
|
|
39
43
|
version,
|
|
40
44
|
artifactHash,
|
|
@@ -60,24 +64,20 @@ export class ContractClassRegisteredEvent {
|
|
|
60
64
|
throw new Error(`Unexpected contract class version ${this.version}`);
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8985): Remove public functions.
|
|
64
|
-
const publicFunctions: PublicFunction[] = [];
|
|
65
|
-
if (this.packedPublicBytecode.length > 0) {
|
|
66
|
-
publicFunctions.push({
|
|
67
|
-
selector: FunctionSelector.fromField(new Fr(PUBLIC_DISPATCH_SELECTOR)),
|
|
68
|
-
bytecode: this.packedPublicBytecode,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
67
|
return {
|
|
73
68
|
id: this.contractClassId,
|
|
74
69
|
artifactHash: this.artifactHash,
|
|
75
70
|
packedBytecode: this.packedPublicBytecode,
|
|
76
71
|
privateFunctionsRoot: this.privateFunctionsRoot,
|
|
77
|
-
publicFunctions: publicFunctions,
|
|
78
72
|
version: this.version,
|
|
79
73
|
privateFunctions: [],
|
|
80
|
-
|
|
74
|
+
utilityFunctions: [],
|
|
81
75
|
};
|
|
82
76
|
}
|
|
77
|
+
|
|
78
|
+
public static extractContractClassEvents(logs: ContractClassLog[]): ContractClassPublishedEvent[] {
|
|
79
|
+
return logs
|
|
80
|
+
.filter((log: ContractClassLog) => ContractClassPublishedEvent.isContractClassPublishedEvent(log))
|
|
81
|
+
.map((log: ContractClassLog) => ContractClassPublishedEvent.fromLog(log));
|
|
82
|
+
}
|
|
83
83
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
3
|
+
|
|
4
|
+
import ContractClassRegistryJson from '../../artifacts/ContractClassRegistry.json' with { type: 'json' };
|
|
5
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
7
|
+
|
|
8
|
+
export * from './contract_class_published_event.js';
|
|
9
|
+
export * from './private_function_broadcasted_event.js';
|
|
10
|
+
export * from './utility_function_broadcasted_event.js';
|
|
11
|
+
|
|
12
|
+
export const ContractClassRegistryArtifact = loadContractArtifact(ContractClassRegistryJson as NoirCompiledContract);
|
|
13
|
+
|
|
14
|
+
let protocolContract: ProtocolContract;
|
|
15
|
+
|
|
16
|
+
/** Returns the canonical deployment of the contract. */
|
|
17
|
+
export function getCanonicalClassRegistry(): Promise<ProtocolContract> {
|
|
18
|
+
if (!protocolContract) {
|
|
19
|
+
const artifact = ContractClassRegistryArtifact;
|
|
20
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', artifact);
|
|
21
|
+
}
|
|
22
|
+
return Promise.resolve(protocolContract);
|
|
23
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ContractArtifact, loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
|
|
3
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
4
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
5
|
+
|
|
6
|
+
export * from './contract_class_published_event.js';
|
|
7
|
+
export * from './private_function_broadcasted_event.js';
|
|
8
|
+
export * from './utility_function_broadcasted_event.js';
|
|
9
|
+
|
|
10
|
+
let protocolContract: ProtocolContract;
|
|
11
|
+
let protocolContractArtifact: ContractArtifact;
|
|
12
|
+
|
|
13
|
+
export async function getContractClassRegistryArtifact(): Promise<ContractArtifact> {
|
|
14
|
+
if (!protocolContractArtifact) {
|
|
15
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
16
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
17
|
+
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
18
|
+
// "text/javascript"
|
|
19
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
20
|
+
const { default: contractClassRegistryJson } = await import('../../artifacts/ContractClassRegistry.json');
|
|
21
|
+
protocolContractArtifact = loadContractArtifact(contractClassRegistryJson);
|
|
22
|
+
}
|
|
23
|
+
return protocolContractArtifact;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Returns the canonical deployment of the auth registry. */
|
|
27
|
+
export async function getCanonicalClassRegistry(): Promise<ProtocolContract> {
|
|
28
|
+
if (!protocolContract) {
|
|
29
|
+
const contractClassRegistryArtifact = await getContractClassRegistryArtifact();
|
|
30
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', contractClassRegistryArtifact);
|
|
31
|
+
}
|
|
32
|
+
return protocolContract;
|
|
33
|
+
}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARTIFACT_FUNCTION_TREE_MAX_HEIGHT,
|
|
3
|
+
CONTRACT_CLASS_REGISTRY_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE,
|
|
3
4
|
FUNCTION_TREE_HEIGHT,
|
|
4
5
|
MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
|
|
5
6
|
} from '@aztec/constants';
|
|
6
|
-
import { Fr } from '@aztec/foundation/
|
|
7
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
8
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
8
9
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
9
10
|
import { FunctionSelector, bufferFromFields } from '@aztec/stdlib/abi';
|
|
10
11
|
import type { ExecutablePrivateFunctionWithMembershipProof, PrivateFunction } from '@aztec/stdlib/contract';
|
|
11
12
|
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
+
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
14
15
|
|
|
15
|
-
/** Event emitted from the
|
|
16
|
+
/** Event emitted from the ContractClassRegistry. */
|
|
16
17
|
export class PrivateFunctionBroadcastedEvent {
|
|
17
18
|
constructor(
|
|
18
19
|
public readonly contractClassId: Fr,
|
|
19
20
|
public readonly artifactMetadataHash: Fr,
|
|
20
|
-
public readonly
|
|
21
|
+
public readonly utilityFunctionsTreeRoot: Fr,
|
|
21
22
|
public readonly privateFunctionTreeSiblingPath: Tuple<Fr, typeof FUNCTION_TREE_HEIGHT>,
|
|
22
23
|
public readonly privateFunctionTreeLeafIndex: number,
|
|
23
24
|
public readonly artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>,
|
|
@@ -26,11 +27,14 @@ export class PrivateFunctionBroadcastedEvent {
|
|
|
26
27
|
) {}
|
|
27
28
|
|
|
28
29
|
static isPrivateFunctionBroadcastedEvent(log: ContractClassLog) {
|
|
29
|
-
return
|
|
30
|
+
return (
|
|
31
|
+
log.contractAddress.equals(ProtocolContractAddress.ContractClassRegistry) &&
|
|
32
|
+
log.fields.fields[0].toBigInt() === CONTRACT_CLASS_REGISTRY_PRIVATE_FUNCTION_BROADCASTED_MAGIC_VALUE
|
|
33
|
+
);
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
static fromLog(log: ContractClassLog) {
|
|
33
|
-
const reader = new FieldReader(log.fields.slice(1));
|
|
37
|
+
const reader = new FieldReader(log.fields.fields.slice(1));
|
|
34
38
|
const event = PrivateFunctionBroadcastedEvent.fromFields(reader);
|
|
35
39
|
while (!reader.isFinished()) {
|
|
36
40
|
const field = reader.readField();
|
|
@@ -46,7 +50,7 @@ export class PrivateFunctionBroadcastedEvent {
|
|
|
46
50
|
const reader = FieldReader.asReader(fields);
|
|
47
51
|
const contractClassId = reader.readField();
|
|
48
52
|
const artifactMetadataHash = reader.readField();
|
|
49
|
-
const
|
|
53
|
+
const utilityFunctionsTreeRoot = reader.readField();
|
|
50
54
|
const privateFunctionTreeSiblingPath = reader.readFieldArray(FUNCTION_TREE_HEIGHT);
|
|
51
55
|
const privateFunctionTreeLeafIndex = reader.readField().toNumber();
|
|
52
56
|
const artifactFunctionTreeSiblingPath = reader.readFieldArray(ARTIFACT_FUNCTION_TREE_MAX_HEIGHT);
|
|
@@ -56,7 +60,7 @@ export class PrivateFunctionBroadcastedEvent {
|
|
|
56
60
|
return new PrivateFunctionBroadcastedEvent(
|
|
57
61
|
contractClassId,
|
|
58
62
|
artifactMetadataHash,
|
|
59
|
-
|
|
63
|
+
utilityFunctionsTreeRoot,
|
|
60
64
|
privateFunctionTreeSiblingPath,
|
|
61
65
|
privateFunctionTreeLeafIndex,
|
|
62
66
|
artifactFunctionTreeSiblingPath,
|
|
@@ -71,7 +75,7 @@ export class PrivateFunctionBroadcastedEvent {
|
|
|
71
75
|
bytecode: this.privateFunction.bytecode,
|
|
72
76
|
functionMetadataHash: this.privateFunction.metadataHash,
|
|
73
77
|
artifactMetadataHash: this.artifactMetadataHash,
|
|
74
|
-
|
|
78
|
+
utilityFunctionsTreeRoot: this.utilityFunctionsTreeRoot,
|
|
75
79
|
privateFunctionTreeSiblingPath: this.privateFunctionTreeSiblingPath,
|
|
76
80
|
privateFunctionTreeLeafIndex: this.privateFunctionTreeLeafIndex,
|
|
77
81
|
artifactTreeSiblingPath: this.artifactFunctionTreeSiblingPath.filter(fr => !fr.isZero()),
|
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARTIFACT_FUNCTION_TREE_MAX_HEIGHT,
|
|
3
|
-
|
|
3
|
+
CONTRACT_CLASS_REGISTRY_UTILITY_FUNCTION_BROADCASTED_MAGIC_VALUE,
|
|
4
|
+
MAX_PACKED_BYTECODE_SIZE_PER_UTILITY_FUNCTION_IN_FIELDS,
|
|
4
5
|
} from '@aztec/constants';
|
|
5
6
|
import { removeArrayPaddingEnd } from '@aztec/foundation/collection';
|
|
6
|
-
import { Fr } from '@aztec/foundation/
|
|
7
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
8
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
8
9
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
9
10
|
import { FunctionSelector, bufferFromFields } from '@aztec/stdlib/abi';
|
|
10
|
-
import type {
|
|
11
|
+
import type { UtilityFunction, UtilityFunctionWithMembershipProof } from '@aztec/stdlib/contract';
|
|
11
12
|
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
+
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
14
15
|
|
|
15
|
-
/** Event emitted from the
|
|
16
|
-
export class
|
|
16
|
+
/** Event emitted from the ContractClassRegistry. */
|
|
17
|
+
export class UtilityFunctionBroadcastedEvent {
|
|
17
18
|
constructor(
|
|
18
19
|
public readonly contractClassId: Fr,
|
|
19
20
|
public readonly artifactMetadataHash: Fr,
|
|
20
21
|
public readonly privateFunctionsArtifactTreeRoot: Fr,
|
|
21
22
|
public readonly artifactFunctionTreeSiblingPath: Tuple<Fr, typeof ARTIFACT_FUNCTION_TREE_MAX_HEIGHT>,
|
|
22
23
|
public readonly artifactFunctionTreeLeafIndex: number,
|
|
23
|
-
public readonly
|
|
24
|
+
public readonly utilityFunction: BroadcastedUtilityFunction,
|
|
24
25
|
) {}
|
|
25
26
|
|
|
26
|
-
static
|
|
27
|
-
return
|
|
27
|
+
static isUtilityFunctionBroadcastedEvent(log: ContractClassLog) {
|
|
28
|
+
return (
|
|
29
|
+
log.contractAddress.equals(ProtocolContractAddress.ContractClassRegistry) &&
|
|
30
|
+
log.fields.fields[0].toBigInt() === CONTRACT_CLASS_REGISTRY_UTILITY_FUNCTION_BROADCASTED_MAGIC_VALUE
|
|
31
|
+
);
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
static fromLog(log: ContractClassLog) {
|
|
31
|
-
const reader = new FieldReader(log.fields.slice(1));
|
|
32
|
-
const event =
|
|
35
|
+
const reader = new FieldReader(log.fields.fields.slice(1));
|
|
36
|
+
const event = UtilityFunctionBroadcastedEvent.fromFields(reader);
|
|
33
37
|
while (!reader.isFinished()) {
|
|
34
38
|
const field = reader.readField();
|
|
35
39
|
if (!field.isZero()) {
|
|
36
|
-
throw new Error(`Unexpected data after parsing
|
|
40
|
+
throw new Error(`Unexpected data after parsing UtilityFunctionBroadcastedEvent: ${field.toString()}`);
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
|
|
@@ -47,28 +51,28 @@ export class UnconstrainedFunctionBroadcastedEvent {
|
|
|
47
51
|
const privateFunctionsArtifactTreeRoot = reader.readField();
|
|
48
52
|
const artifactFunctionTreeSiblingPath = reader.readFieldArray(ARTIFACT_FUNCTION_TREE_MAX_HEIGHT);
|
|
49
53
|
const artifactFunctionTreeLeafIndex = reader.readField().toNumber();
|
|
50
|
-
const
|
|
54
|
+
const utilityFunction = BroadcastedUtilityFunction.fromFields(reader);
|
|
51
55
|
|
|
52
|
-
return new
|
|
56
|
+
return new UtilityFunctionBroadcastedEvent(
|
|
53
57
|
contractClassId,
|
|
54
58
|
artifactMetadataHash,
|
|
55
59
|
privateFunctionsArtifactTreeRoot,
|
|
56
60
|
artifactFunctionTreeSiblingPath,
|
|
57
61
|
artifactFunctionTreeLeafIndex,
|
|
58
|
-
|
|
62
|
+
utilityFunction,
|
|
59
63
|
);
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
toFunctionWithMembershipProof():
|
|
66
|
+
toFunctionWithMembershipProof(): UtilityFunctionWithMembershipProof {
|
|
63
67
|
// We should be able to safely remove the zero elements that pad the variable-length sibling path,
|
|
64
68
|
// since a sibling with value zero can only occur on the tree leaves, so the sibling path will never end
|
|
65
69
|
// in a zero. The only exception is a tree with depth 2 with one non-zero leaf, where the sibling path would
|
|
66
70
|
// be a single zero element, but in that case the artifact tree should be just the single leaf.
|
|
67
71
|
const artifactTreeSiblingPath = removeArrayPaddingEnd(this.artifactFunctionTreeSiblingPath, Fr.isZero);
|
|
68
72
|
return {
|
|
69
|
-
...this.
|
|
70
|
-
bytecode: this.
|
|
71
|
-
functionMetadataHash: this.
|
|
73
|
+
...this.utilityFunction,
|
|
74
|
+
bytecode: this.utilityFunction.bytecode,
|
|
75
|
+
functionMetadataHash: this.utilityFunction.metadataHash,
|
|
72
76
|
artifactMetadataHash: this.artifactMetadataHash,
|
|
73
77
|
privateFunctionsArtifactTreeRoot: this.privateFunctionsArtifactTreeRoot,
|
|
74
78
|
artifactTreeSiblingPath,
|
|
@@ -77,7 +81,7 @@ export class UnconstrainedFunctionBroadcastedEvent {
|
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
|
|
80
|
-
export class
|
|
84
|
+
export class BroadcastedUtilityFunction implements UtilityFunction {
|
|
81
85
|
constructor(
|
|
82
86
|
/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
|
|
83
87
|
public readonly selector: FunctionSelector,
|
|
@@ -92,8 +96,8 @@ export class BroadcastedUnconstrainedFunction implements UnconstrainedFunction {
|
|
|
92
96
|
const selector = FunctionSelector.fromField(reader.readField());
|
|
93
97
|
const metadataHash = reader.readField();
|
|
94
98
|
// The '* 1' removes the 'Type instantiation is excessively deep and possibly infinite. ts(2589)' err
|
|
95
|
-
const encodedBytecode = reader.readFieldArray(
|
|
99
|
+
const encodedBytecode = reader.readFieldArray(MAX_PACKED_BYTECODE_SIZE_PER_UTILITY_FUNCTION_IN_FIELDS * 1);
|
|
96
100
|
const bytecode = bufferFromFields(encodedBytecode);
|
|
97
|
-
return new
|
|
101
|
+
return new BroadcastedUtilityFunction(selector, metadataHash, bytecode);
|
|
98
102
|
}
|
|
99
103
|
}
|
package/src/fee-juice/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import { computePublicDataTreeLeafSlot, deriveStorageSlotInMap } from '@aztec/stdlib/hash';
|
|
5
5
|
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
6
6
|
|
|
7
|
-
import FeeJuiceJson from '../../artifacts/FeeJuice.json'
|
|
7
|
+
import FeeJuiceJson from '../../artifacts/FeeJuice.json' with { type: 'json' };
|
|
8
8
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
9
9
|
import type { ProtocolContract } from '../protocol_contract.js';
|
|
10
10
|
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
@@ -14,11 +14,11 @@ export const FeeJuiceArtifact = loadContractArtifact(FeeJuiceJson as NoirCompile
|
|
|
14
14
|
let protocolContract: ProtocolContract;
|
|
15
15
|
|
|
16
16
|
/** Returns the canonical deployment of the contract. */
|
|
17
|
-
export
|
|
17
|
+
export function getCanonicalFeeJuice(): Promise<ProtocolContract> {
|
|
18
18
|
if (!protocolContract) {
|
|
19
|
-
protocolContract =
|
|
19
|
+
protocolContract = makeProtocolContract('FeeJuice', FeeJuiceArtifact);
|
|
20
20
|
}
|
|
21
|
-
return protocolContract;
|
|
21
|
+
return Promise.resolve(protocolContract);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
package/src/fee-juice/lazy.ts
CHANGED
|
@@ -8,10 +8,10 @@ let protocolContractArtifact: ContractArtifact;
|
|
|
8
8
|
|
|
9
9
|
export async function getFeeJuiceArtifact(): Promise<ContractArtifact> {
|
|
10
10
|
if (!protocolContractArtifact) {
|
|
11
|
-
// Cannot assert this import as it's incompatible with
|
|
12
|
-
// https://
|
|
13
|
-
//
|
|
14
|
-
//
|
|
11
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
12
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
13
|
+
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
14
|
+
// "text/javascript"
|
|
15
15
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
16
16
|
const { default: feeJuiceJson } = await import('../../artifacts/FeeJuice.json');
|
|
17
17
|
protocolContractArtifact = loadContractArtifact(feeJuiceJson);
|
|
@@ -23,7 +23,7 @@ export async function getFeeJuiceArtifact(): Promise<ContractArtifact> {
|
|
|
23
23
|
export async function getCanonicalFeeJuice(): Promise<ProtocolContract> {
|
|
24
24
|
if (!protocolContract) {
|
|
25
25
|
const feeJuiceArtifact = await getFeeJuiceArtifact();
|
|
26
|
-
protocolContract =
|
|
26
|
+
protocolContract = makeProtocolContract('FeeJuice', feeJuiceArtifact);
|
|
27
27
|
}
|
|
28
28
|
return protocolContract;
|
|
29
29
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
5
5
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
6
6
|
import type { PrivateLog } from '@aztec/stdlib/logs';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG } from '../protocol_contract_data.js';
|
|
9
9
|
|
|
10
|
-
/** Event emitted from the
|
|
11
|
-
export class
|
|
10
|
+
/** Event emitted from the ContractInstanceRegistry. */
|
|
11
|
+
export class ContractInstancePublishedEvent {
|
|
12
12
|
constructor(
|
|
13
13
|
public readonly address: AztecAddress,
|
|
14
14
|
public readonly version: number,
|
|
@@ -19,8 +19,8 @@ export class ContractInstanceDeployedEvent {
|
|
|
19
19
|
public readonly deployer: AztecAddress,
|
|
20
20
|
) {}
|
|
21
21
|
|
|
22
|
-
static
|
|
23
|
-
return log.fields[0].equals(
|
|
22
|
+
static isContractInstancePublishedEvent(log: PrivateLog) {
|
|
23
|
+
return log.fields[0].equals(CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
static fromLog(log: PrivateLog) {
|
|
@@ -34,7 +34,7 @@ export class ContractInstanceDeployedEvent {
|
|
|
34
34
|
const publicKeys = reader.readObject(PublicKeys);
|
|
35
35
|
const deployer = reader.readObject(AztecAddress);
|
|
36
36
|
|
|
37
|
-
return new
|
|
37
|
+
return new ContractInstancePublishedEvent(
|
|
38
38
|
address,
|
|
39
39
|
version,
|
|
40
40
|
salt,
|
|
@@ -61,4 +61,10 @@ export class ContractInstanceDeployedEvent {
|
|
|
61
61
|
deployer: this.deployer,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
public static extractContractInstanceEvents(logs: PrivateLog[]): ContractInstancePublishedEvent[] {
|
|
66
|
+
return logs
|
|
67
|
+
.filter(log => ContractInstancePublishedEvent.isContractInstancePublishedEvent(log))
|
|
68
|
+
.map(log => ContractInstancePublishedEvent.fromLog(log));
|
|
69
|
+
}
|
|
64
70
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CONTRACT_INSTANCE_UPDATED_MAGIC_VALUE } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import type { ContractInstanceUpdateWithAddress } from '@aztec/stdlib/contract';
|
|
5
6
|
import type { PublicLog } from '@aztec/stdlib/logs';
|
|
7
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
6
8
|
|
|
7
|
-
import {
|
|
9
|
+
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
8
10
|
|
|
9
|
-
/** Event emitted from the
|
|
11
|
+
/** Event emitted from the ContractInstanceRegistry. */
|
|
10
12
|
export class ContractInstanceUpdatedEvent {
|
|
11
13
|
constructor(
|
|
12
14
|
public readonly address: AztecAddress,
|
|
13
15
|
public readonly prevContractClassId: Fr,
|
|
14
16
|
public readonly newContractClassId: Fr,
|
|
15
|
-
public readonly
|
|
17
|
+
public readonly timestampOfChange: UInt64,
|
|
16
18
|
) {}
|
|
17
19
|
|
|
18
20
|
static isContractInstanceUpdatedEvent(log: PublicLog) {
|
|
19
21
|
return (
|
|
20
|
-
log.contractAddress.equals(ProtocolContractAddress.
|
|
21
|
-
log.
|
|
22
|
+
log.contractAddress.equals(ProtocolContractAddress.ContractInstanceRegistry) &&
|
|
23
|
+
log.fields[0].toBigInt() === CONTRACT_INSTANCE_UPDATED_MAGIC_VALUE
|
|
22
24
|
);
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
static fromLog(log: PublicLog) {
|
|
26
|
-
const
|
|
27
|
-
const reader = new BufferReader(bufferWithoutAddressAndTag);
|
|
28
|
+
const reader = new FieldReader(log.fields.slice(1) /* remove tag */);
|
|
28
29
|
const address = reader.readObject(AztecAddress);
|
|
29
|
-
const prevContractClassId = reader.
|
|
30
|
-
const newContractClassId = reader.
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
return new ContractInstanceUpdatedEvent(address, prevContractClassId, newContractClassId, blockOfChange);
|
|
30
|
+
const prevContractClassId = reader.readField();
|
|
31
|
+
const newContractClassId = reader.readField();
|
|
32
|
+
const timestampOfChange = reader.readField().toBigInt();
|
|
33
|
+
return new ContractInstanceUpdatedEvent(address, prevContractClassId, newContractClassId, timestampOfChange);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
toContractInstanceUpdate(): ContractInstanceUpdateWithAddress {
|
|
@@ -38,7 +38,7 @@ export class ContractInstanceUpdatedEvent {
|
|
|
38
38
|
address: this.address,
|
|
39
39
|
prevContractClassId: this.prevContractClassId,
|
|
40
40
|
newContractClassId: this.newContractClassId,
|
|
41
|
-
|
|
41
|
+
timestampOfChange: this.timestampOfChange,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
3
|
+
|
|
4
|
+
import ContractInstanceRegistryJson from '../../artifacts/ContractInstanceRegistry.json' with { type: 'json' };
|
|
5
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
6
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
7
|
+
|
|
8
|
+
export * from './contract_instance_published_event.js';
|
|
9
|
+
export * from './contract_instance_updated_event.js';
|
|
10
|
+
|
|
11
|
+
export const ContractInstanceRegistryArtifact = loadContractArtifact(
|
|
12
|
+
ContractInstanceRegistryJson as NoirCompiledContract,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
let protocolContract: ProtocolContract;
|
|
16
|
+
|
|
17
|
+
/** Returns the canonical deployment of the contract. */
|
|
18
|
+
export function getCanonicalInstanceRegistry(): Promise<ProtocolContract> {
|
|
19
|
+
if (!protocolContract) {
|
|
20
|
+
protocolContract = makeProtocolContract('ContractInstanceRegistry', ContractInstanceRegistryArtifact);
|
|
21
|
+
}
|
|
22
|
+
return Promise.resolve(protocolContract);
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ContractArtifact, loadContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
|
|
3
|
+
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
4
|
+
import type { ProtocolContract } from '../protocol_contract.js';
|
|
5
|
+
|
|
6
|
+
export * from './contract_instance_published_event.js';
|
|
7
|
+
export * from './contract_instance_updated_event.js';
|
|
8
|
+
|
|
9
|
+
let protocolContract: ProtocolContract;
|
|
10
|
+
let protocolContractArtifact: ContractArtifact;
|
|
11
|
+
|
|
12
|
+
export async function getContractInstanceRegistryArtifact(): Promise<ContractArtifact> {
|
|
13
|
+
if (!protocolContractArtifact) {
|
|
14
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
15
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
16
|
+
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
17
|
+
// "text/javascript"
|
|
18
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
19
|
+
const { default: contractInstanceRegistryJson } = await import('../../artifacts/ContractInstanceRegistry.json');
|
|
20
|
+
protocolContractArtifact = loadContractArtifact(contractInstanceRegistryJson);
|
|
21
|
+
}
|
|
22
|
+
return protocolContractArtifact;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Returns the canonical deployment of the auth registry. */
|
|
26
|
+
export async function getCanonicalInstanceRegistry(): Promise<ProtocolContract> {
|
|
27
|
+
if (!protocolContract) {
|
|
28
|
+
const contractInstanceRegistryArtifact = await getContractInstanceRegistryArtifact();
|
|
29
|
+
protocolContract = makeProtocolContract('ContractInstanceRegistry', contractInstanceRegistryArtifact);
|
|
30
|
+
}
|
|
31
|
+
return protocolContract;
|
|
32
|
+
}
|
|
@@ -1,26 +1,48 @@
|
|
|
1
1
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import {
|
|
2
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
3
3
|
|
|
4
4
|
import type { ProtocolContract } from './protocol_contract.js';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ProtocolContractAddress,
|
|
7
|
+
ProtocolContractClassId,
|
|
8
|
+
ProtocolContractClassIdPreimage,
|
|
9
|
+
ProtocolContractInitializationHash,
|
|
10
|
+
type ProtocolContractName,
|
|
11
|
+
ProtocolContractPrivateFunctions,
|
|
12
|
+
ProtocolContractSalt,
|
|
13
|
+
} from './protocol_contract_data.js';
|
|
6
14
|
|
|
7
15
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
16
|
+
* Reconstructs a ProtocolContract from precomputed data without performing any hash computations.
|
|
17
|
+
* Internal to the protocol-contracts package — not part of the public API.
|
|
10
18
|
*/
|
|
11
|
-
export
|
|
12
|
-
name: ProtocolContractName,
|
|
13
|
-
artifact: ContractArtifact,
|
|
14
|
-
): Promise<ProtocolContract> {
|
|
19
|
+
export function makeProtocolContract(name: ProtocolContractName, artifact: ContractArtifact): ProtocolContract {
|
|
15
20
|
const address = ProtocolContractAddress[name];
|
|
16
21
|
const salt = ProtocolContractSalt[name];
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const classId = ProtocolContractClassId[name];
|
|
23
|
+
const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment } = ProtocolContractClassIdPreimage[name];
|
|
24
|
+
const initializationHash = ProtocolContractInitializationHash[name];
|
|
25
|
+
|
|
26
|
+
const contractClass = {
|
|
27
|
+
id: classId,
|
|
28
|
+
version: 1 as const,
|
|
29
|
+
artifactHash,
|
|
30
|
+
privateFunctionsRoot,
|
|
31
|
+
publicBytecodeCommitment,
|
|
32
|
+
packedBytecode: artifact.functions.find(f => f.name === 'public_dispatch')?.bytecode ?? Buffer.alloc(0),
|
|
33
|
+
privateFunctions: ProtocolContractPrivateFunctions[name],
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const instance = {
|
|
37
|
+
version: 1 as const,
|
|
38
|
+
currentContractClassId: classId,
|
|
39
|
+
originalContractClassId: classId,
|
|
40
|
+
initializationHash,
|
|
41
|
+
publicKeys: PublicKeys.default(),
|
|
42
|
+
salt,
|
|
43
|
+
deployer: address,
|
|
24
44
|
address,
|
|
25
45
|
};
|
|
46
|
+
|
|
47
|
+
return { instance, contractClass, artifact, address };
|
|
26
48
|
}
|