@aztec/protocol-contracts 0.0.0-test.1 → 0.0.1-commit.017a351
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/ContractClassRegistry.json +3950 -0
- package/artifacts/ContractInstanceRegistry.json +5132 -0
- package/artifacts/FeeJuice.json +5171 -2507
- package/dest/class-registry/contract_class_published_event.d.ts +20 -0
- package/dest/class-registry/contract_class_published_event.d.ts.map +1 -0
- package/dest/class-registry/contract_class_published_event.js +52 -0
- package/dest/class-registry/index.d.ts +6 -0
- package/dest/class-registry/index.d.ts.map +1 -0
- package/dest/class-registry/index.js +15 -0
- package/dest/class-registry/lazy.d.ts +7 -0
- package/dest/class-registry/lazy.d.ts.map +1 -0
- package/dest/class-registry/lazy.js +24 -0
- 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 +22 -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} +15 -8
- 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 +30 -14
- package/dest/protocol_contract.d.ts +1 -1
- package/dest/protocol_contract_data.d.ts +23 -16
- package/dest/protocol_contract_data.d.ts.map +1 -1
- package/dest/protocol_contract_data.js +82 -32
- package/dest/provider/bundle.d.ts +1 -1
- package/dest/provider/bundle.d.ts.map +1 -1
- package/dest/provider/bundle.js +6 -12
- package/dest/provider/lazy.d.ts +1 -1
- package/dest/provider/lazy.d.ts.map +1 -1
- package/dest/provider/lazy.js +6 -15
- package/dest/provider/protocol_contracts_provider.d.ts +1 -1
- package/dest/scripts/cleanup_artifacts.js +2 -2
- package/dest/scripts/generate_data.js +96 -56
- package/dest/tests/fixtures.d.ts +3 -7
- package/dest/tests/fixtures.d.ts.map +1 -1
- package/dest/tests/fixtures.js +4 -14
- package/package.json +23 -20
- package/src/class-registry/__snapshots__/README.md +9 -0
- package/src/class-registry/contract_class_published_event.ts +72 -0
- package/src/class-registry/index.ts +21 -0
- package/src/class-registry/lazy.ts +31 -0
- 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} +18 -8
- 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 +39 -15
- package/src/protocol_contract_data.ts +70 -32
- package/src/provider/bundle.ts +5 -11
- package/src/provider/lazy.ts +6 -15
- package/src/tests/fixtures.ts +4 -16
- package/artifacts/AuthRegistry.json +0 -2725
- package/artifacts/ContractClassRegisterer.json +0 -7219
- package/artifacts/ContractInstanceDeployer.d.json.ts +0 -5
- package/artifacts/ContractInstanceDeployer.json +0 -2984
- package/artifacts/MultiCallEntrypoint.d.json.ts +0 -5
- package/artifacts/MultiCallEntrypoint.json +0 -2005
- package/artifacts/Router.d.json.ts +0 -5
- package/artifacts/Router.json +0 -3798
- package/dest/auth-registry/index.d.ts +0 -5
- package/dest/auth-registry/index.d.ts.map +0 -1
- package/dest/auth-registry/index.js +0 -13
- package/dest/auth-registry/lazy.d.ts +0 -6
- package/dest/auth-registry/lazy.d.ts.map +0 -1
- package/dest/auth-registry/lazy.js +0 -23
- 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/contract_class_registered_event.js +0 -63
- 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/private_function_broadcasted_event.js +0 -85
- 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/class-registerer/unconstrained_function_broadcasted_event.js +0 -81
- 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/multi-call-entrypoint/index.d.ts +0 -5
- package/dest/multi-call-entrypoint/index.d.ts.map +0 -1
- package/dest/multi-call-entrypoint/index.js +0 -13
- package/dest/multi-call-entrypoint/lazy.d.ts +0 -6
- package/dest/multi-call-entrypoint/lazy.d.ts.map +0 -1
- package/dest/multi-call-entrypoint/lazy.js +0 -23
- 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/auth-registry/index.ts +0 -18
- package/src/auth-registry/lazy.ts +0 -29
- package/src/build_protocol_contract_tree.ts +0 -29
- package/src/class-registerer/contract_class_registered_event.ts +0 -83
- package/src/class-registerer/index.ts +0 -25
- package/src/class-registerer/lazy.ts +0 -33
- package/src/class-registerer/private_function_broadcasted_event.ts +0 -105
- package/src/class-registerer/unconstrained_function_broadcasted_event.ts +0 -99
- package/src/instance-deployer/index.ts +0 -23
- package/src/instance-deployer/lazy.ts +0 -32
- package/src/multi-call-entrypoint/index.ts +0 -18
- package/src/multi-call-entrypoint/lazy.ts +0 -29
- package/src/protocol_contract_tree.ts +0 -44
- package/src/router/index.ts +0 -18
- package/src/router/lazy.ts +0 -29
- /package/artifacts/{AuthRegistry.d.json.ts → ContractClassRegistry.d.json.ts} +0 -0
- /package/artifacts/{ContractClassRegisterer.d.json.ts → ContractInstanceRegistry.d.json.ts} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CONTRACT_CLASS_PUBLISHED_MAGIC_VALUE } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { FieldReader } from '@aztec/foundation/serialize';
|
|
4
|
+
import { bufferFromFields } from '@aztec/stdlib/abi';
|
|
5
|
+
import {
|
|
6
|
+
type ContractClassPublic,
|
|
7
|
+
type ContractClassPublicWithCommitment,
|
|
8
|
+
computePublicBytecodeCommitment,
|
|
9
|
+
} from '@aztec/stdlib/contract';
|
|
10
|
+
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
11
|
+
|
|
12
|
+
import { ProtocolContractAddress } from '../protocol_contract_data.js';
|
|
13
|
+
|
|
14
|
+
/** Event emitted from the ContractClassRegistry. */
|
|
15
|
+
export class ContractClassPublishedEvent {
|
|
16
|
+
constructor(
|
|
17
|
+
public readonly contractClassId: Fr,
|
|
18
|
+
public readonly version: number,
|
|
19
|
+
public readonly artifactHash: Fr,
|
|
20
|
+
public readonly privateFunctionsRoot: Fr,
|
|
21
|
+
public readonly packedPublicBytecode: Buffer,
|
|
22
|
+
) {}
|
|
23
|
+
|
|
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
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static fromLog(log: ContractClassLog) {
|
|
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);
|
|
35
|
+
const contractClassId = reader.readField();
|
|
36
|
+
const version = reader.readField().toNumber();
|
|
37
|
+
const artifactHash = reader.readField();
|
|
38
|
+
const privateFunctionsRoot = reader.readField();
|
|
39
|
+
const packedPublicBytecode = bufferFromFields(reader.readFieldArray(fieldsWithoutTag.length - reader.cursor));
|
|
40
|
+
|
|
41
|
+
return new ContractClassPublishedEvent(
|
|
42
|
+
contractClassId,
|
|
43
|
+
version,
|
|
44
|
+
artifactHash,
|
|
45
|
+
privateFunctionsRoot,
|
|
46
|
+
packedPublicBytecode,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Converts the event to a contract class, without computing or validating the bytecode commitment. */
|
|
51
|
+
toContractClassPublic(): ContractClassPublic {
|
|
52
|
+
return {
|
|
53
|
+
id: this.contractClassId,
|
|
54
|
+
artifactHash: this.artifactHash,
|
|
55
|
+
packedBytecode: this.packedPublicBytecode,
|
|
56
|
+
privateFunctionsRoot: this.privateFunctionsRoot,
|
|
57
|
+
version: this.version as 1,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Converts the event to a contract class with its bytecode commitment (expensive). */
|
|
62
|
+
async toContractClassPublicWithBytecodeCommitment(): Promise<ContractClassPublicWithCommitment> {
|
|
63
|
+
const publicBytecodeCommitment = await computePublicBytecodeCommitment(this.packedPublicBytecode);
|
|
64
|
+
return { ...this.toContractClassPublic(), publicBytecodeCommitment };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public static extractContractClassEvents(logs: ContractClassLog[]): ContractClassPublishedEvent[] {
|
|
68
|
+
return logs
|
|
69
|
+
.filter((log: ContractClassLog) => ContractClassPublishedEvent.isContractClassPublishedEvent(log))
|
|
70
|
+
.map((log: ContractClassLog) => ContractClassPublishedEvent.fromLog(log));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
|
|
10
|
+
export const ContractClassRegistryArtifact = loadContractArtifact(ContractClassRegistryJson as NoirCompiledContract);
|
|
11
|
+
|
|
12
|
+
let protocolContract: ProtocolContract;
|
|
13
|
+
|
|
14
|
+
/** Returns the canonical deployment of the contract. */
|
|
15
|
+
export function getCanonicalClassRegistry(): Promise<ProtocolContract> {
|
|
16
|
+
if (!protocolContract) {
|
|
17
|
+
const artifact = ContractClassRegistryArtifact;
|
|
18
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', artifact);
|
|
19
|
+
}
|
|
20
|
+
return Promise.resolve(protocolContract);
|
|
21
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
|
|
8
|
+
let protocolContract: ProtocolContract;
|
|
9
|
+
let protocolContractArtifact: ContractArtifact;
|
|
10
|
+
|
|
11
|
+
export async function getContractClassRegistryArtifact(): Promise<ContractArtifact> {
|
|
12
|
+
if (!protocolContractArtifact) {
|
|
13
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
14
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
15
|
+
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
16
|
+
// "text/javascript"
|
|
17
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
18
|
+
const { default: contractClassRegistryJson } = await import('../../artifacts/ContractClassRegistry.json');
|
|
19
|
+
protocolContractArtifact = loadContractArtifact(contractClassRegistryJson);
|
|
20
|
+
}
|
|
21
|
+
return protocolContractArtifact;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Returns the canonical deployment of the auth registry. */
|
|
25
|
+
export async function getCanonicalClassRegistry(): Promise<ProtocolContract> {
|
|
26
|
+
if (!protocolContract) {
|
|
27
|
+
const contractClassRegistryArtifact = await getContractClassRegistryArtifact();
|
|
28
|
+
protocolContract = makeProtocolContract('ContractClassRegistry', contractClassRegistryArtifact);
|
|
29
|
+
}
|
|
30
|
+
return protocolContract;
|
|
31
|
+
}
|
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,26 +1,27 @@
|
|
|
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,
|
|
15
15
|
public readonly salt: Fr,
|
|
16
16
|
public readonly contractClassId: Fr,
|
|
17
17
|
public readonly initializationHash: Fr,
|
|
18
|
+
public readonly immutablesHash: Fr,
|
|
18
19
|
public readonly publicKeys: PublicKeys,
|
|
19
20
|
public readonly deployer: AztecAddress,
|
|
20
21
|
) {}
|
|
21
22
|
|
|
22
|
-
static
|
|
23
|
-
return log.fields[0].equals(
|
|
23
|
+
static isContractInstancePublishedEvent(log: PrivateLog) {
|
|
24
|
+
return log.fields[0].equals(CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
static fromLog(log: PrivateLog) {
|
|
@@ -31,22 +32,24 @@ export class ContractInstanceDeployedEvent {
|
|
|
31
32
|
const salt = reader.readObject(Fr);
|
|
32
33
|
const contractClassId = reader.readObject(Fr);
|
|
33
34
|
const initializationHash = reader.readObject(Fr);
|
|
35
|
+
const immutablesHash = reader.readObject(Fr);
|
|
34
36
|
const publicKeys = reader.readObject(PublicKeys);
|
|
35
37
|
const deployer = reader.readObject(AztecAddress);
|
|
36
38
|
|
|
37
|
-
return new
|
|
39
|
+
return new ContractInstancePublishedEvent(
|
|
38
40
|
address,
|
|
39
41
|
version,
|
|
40
42
|
salt,
|
|
41
43
|
contractClassId,
|
|
42
44
|
initializationHash,
|
|
45
|
+
immutablesHash,
|
|
43
46
|
publicKeys,
|
|
44
47
|
deployer,
|
|
45
48
|
);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
toContractInstance(): ContractInstanceWithAddress {
|
|
49
|
-
if (this.version !==
|
|
52
|
+
if (this.version !== 2) {
|
|
50
53
|
throw new Error(`Unexpected contract instance version ${this.version}`);
|
|
51
54
|
}
|
|
52
55
|
|
|
@@ -56,9 +59,16 @@ export class ContractInstanceDeployedEvent {
|
|
|
56
59
|
currentContractClassId: this.contractClassId,
|
|
57
60
|
originalContractClassId: this.contractClassId,
|
|
58
61
|
initializationHash: this.initializationHash,
|
|
62
|
+
immutablesHash: this.immutablesHash,
|
|
59
63
|
publicKeys: this.publicKeys,
|
|
60
64
|
salt: this.salt,
|
|
61
65
|
deployer: this.deployer,
|
|
62
66
|
};
|
|
63
67
|
}
|
|
68
|
+
|
|
69
|
+
public static extractContractInstanceEvents(logs: PrivateLog[]): ContractInstancePublishedEvent[] {
|
|
70
|
+
return logs
|
|
71
|
+
.filter(log => ContractInstancePublishedEvent.isContractInstancePublishedEvent(log))
|
|
72
|
+
.map(log => ContractInstancePublishedEvent.fromLog(log));
|
|
73
|
+
}
|
|
64
74
|
}
|
|
@@ -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,50 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
1
2
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import {
|
|
3
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
3
4
|
|
|
4
5
|
import type { ProtocolContract } from './protocol_contract.js';
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ProtocolContractAddress,
|
|
8
|
+
ProtocolContractClassId,
|
|
9
|
+
ProtocolContractClassIdPreimage,
|
|
10
|
+
ProtocolContractInitializationHash,
|
|
11
|
+
type ProtocolContractName,
|
|
12
|
+
ProtocolContractPrivateFunctions,
|
|
13
|
+
ProtocolContractSalt,
|
|
14
|
+
} from './protocol_contract_data.js';
|
|
6
15
|
|
|
7
16
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
17
|
+
* Reconstructs a ProtocolContract from precomputed data without performing any hash computations.
|
|
18
|
+
* Internal to the protocol-contracts package — not part of the public API.
|
|
10
19
|
*/
|
|
11
|
-
export
|
|
12
|
-
name: ProtocolContractName,
|
|
13
|
-
artifact: ContractArtifact,
|
|
14
|
-
): Promise<ProtocolContract> {
|
|
20
|
+
export function makeProtocolContract(name: ProtocolContractName, artifact: ContractArtifact): ProtocolContract {
|
|
15
21
|
const address = ProtocolContractAddress[name];
|
|
16
22
|
const salt = ProtocolContractSalt[name];
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const classId = ProtocolContractClassId[name];
|
|
24
|
+
const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment } = ProtocolContractClassIdPreimage[name];
|
|
25
|
+
const initializationHash = ProtocolContractInitializationHash[name];
|
|
26
|
+
|
|
27
|
+
const contractClass = {
|
|
28
|
+
id: classId,
|
|
29
|
+
version: 1 as const,
|
|
30
|
+
artifactHash,
|
|
31
|
+
privateFunctionsRoot,
|
|
32
|
+
publicBytecodeCommitment,
|
|
33
|
+
packedBytecode: artifact.functions.find(f => f.name === 'public_dispatch')?.bytecode ?? Buffer.alloc(0),
|
|
34
|
+
privateFunctions: ProtocolContractPrivateFunctions[name],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const instance = {
|
|
38
|
+
version: 2 as const,
|
|
39
|
+
currentContractClassId: classId,
|
|
40
|
+
originalContractClassId: classId,
|
|
41
|
+
initializationHash,
|
|
42
|
+
immutablesHash: Fr.ZERO, // Protocol Contracts Have No Immutables
|
|
43
|
+
publicKeys: PublicKeys.default(),
|
|
44
|
+
salt,
|
|
45
|
+
deployer: address,
|
|
24
46
|
address,
|
|
25
47
|
};
|
|
48
|
+
|
|
49
|
+
return { instance, contractClass, artifact, address };
|
|
26
50
|
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
// GENERATED FILE - DO NOT EDIT. RUN `yarn generate` or `yarn generate:data`
|
|
3
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
import { ProtocolContracts } from '@aztec/stdlib/tx';
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
export const protocolContractNames = [
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'MultiCallEntrypoint',
|
|
12
|
-
'FeeJuice',
|
|
13
|
-
'Router'
|
|
10
|
+
'ContractInstanceRegistry',
|
|
11
|
+
'ContractClassRegistry',
|
|
12
|
+
'FeeJuice'
|
|
14
13
|
] as const;
|
|
15
14
|
|
|
16
15
|
export type ProtocolContractName = typeof protocolContractNames[number];
|
|
@@ -18,46 +17,85 @@
|
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
export const ProtocolContractSalt: Record<ProtocolContractName, Fr> = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
MultiCallEntrypoint: new Fr(1),
|
|
25
|
-
FeeJuice: new Fr(1),
|
|
26
|
-
Router: new Fr(1)
|
|
20
|
+
ContractInstanceRegistry: new Fr(1),
|
|
21
|
+
ContractClassRegistry: new Fr(1),
|
|
22
|
+
FeeJuice: new Fr(1)
|
|
27
23
|
};
|
|
28
24
|
|
|
29
25
|
|
|
30
26
|
|
|
31
27
|
export const ProtocolContractAddress: Record<ProtocolContractName, AztecAddress> = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
MultiCallEntrypoint: AztecAddress.fromBigInt(4n),
|
|
36
|
-
FeeJuice: AztecAddress.fromBigInt(5n),
|
|
37
|
-
Router: AztecAddress.fromBigInt(6n)
|
|
28
|
+
ContractInstanceRegistry: AztecAddress.fromBigInt(2n),
|
|
29
|
+
ContractClassRegistry: AztecAddress.fromBigInt(1n),
|
|
30
|
+
FeeJuice: AztecAddress.fromBigInt(3n)
|
|
38
31
|
};
|
|
39
32
|
|
|
40
33
|
|
|
41
34
|
|
|
42
|
-
export const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
MultiCallEntrypoint: Fr.fromHexString('0x121f834b03a64d38463ae18ddebceeb4dce8192cc289052e175ad754a883a7fe'),
|
|
47
|
-
FeeJuice: Fr.fromHexString('0x141a566ade0bef915526762c2c2fb19b2a756ad7c82e83fde6dbf86848ecc131'),
|
|
48
|
-
Router: Fr.fromHexString('0x2c20bd328fbd33c01fbcda9e6299c31da5d5b29ea30e9c7b9d631618b839bca9')
|
|
35
|
+
export const ProtocolContractDerivedAddress = {
|
|
36
|
+
ContractInstanceRegistry: AztecAddress.fromString('0x290f7bf7cea0eb4c440a06dc8bcf825865479348c9ebf8f540b10ad10fd32c44'),
|
|
37
|
+
ContractClassRegistry: AztecAddress.fromString('0x20b16259faa0a096d687572fc76221263f1cad4a4b726ef49e2cd7b7ce7c7465'),
|
|
38
|
+
FeeJuice: AztecAddress.fromString('0x0fa3ba3e01e6646cd2adade41018dbfff04e59c444760e33bf773ec43d683019')
|
|
49
39
|
};
|
|
50
40
|
|
|
51
41
|
|
|
52
42
|
|
|
53
|
-
export const
|
|
43
|
+
export const ProtocolContractClassId: Record<ProtocolContractName, Fr> = {
|
|
44
|
+
ContractInstanceRegistry: Fr.fromString('0x123597d7f3c460a3e91bfb92e729fcd048d4f50a88b7c25e694cf75827062e3f'),
|
|
45
|
+
ContractClassRegistry: Fr.fromString('0x243b6ce1af8f520d531b26ce5081fa29c0870ce8d5949c5304a6705b07947a2e'),
|
|
46
|
+
FeeJuice: Fr.fromString('0x1f65e3db036c48ac8f8635b156880ed17e9437ed8904a0c0554f0d6251bf0997')
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const ProtocolContractClassIdPreimage: Record<ProtocolContractName, { artifactHash: Fr; privateFunctionsRoot: Fr; publicBytecodeCommitment: Fr }> = {
|
|
50
|
+
ContractInstanceRegistry: {
|
|
51
|
+
artifactHash: Fr.fromString('0x0cb37c0b0ec8670b88b472fca5858f8cb112a41ba2aad664903ac1a3bed468b3'),
|
|
52
|
+
privateFunctionsRoot: Fr.fromString('0x0239b0f293384aad456e2e27901eb97cd9073322a28d14b0ac7816a5297b2812'),
|
|
53
|
+
publicBytecodeCommitment: Fr.fromString('0x2c79b6699098244e947caca071a31799c20aa20e7124910a2b7c918fe817d65e'),
|
|
54
|
+
},
|
|
55
|
+
ContractClassRegistry: {
|
|
56
|
+
artifactHash: Fr.fromString('0x1e252471ee2b770fba961d03289344f1798336d9a94e1d8f137397754708de0e'),
|
|
57
|
+
privateFunctionsRoot: Fr.fromString('0x0672f623ec0753ab9fbb02a9a241df81b9bcc0dbed8628d8cab8790e0cb0c03d'),
|
|
58
|
+
publicBytecodeCommitment: Fr.fromString('0x0ce4c618c3ed7f3a20410e618c06bb701e150af7fe28a3e92f68e7733809f33e'),
|
|
59
|
+
},
|
|
60
|
+
FeeJuice: {
|
|
61
|
+
artifactHash: Fr.fromString('0x1243f24c1d3e8b42c900aa95d3a12448d84f8b5da3fe047f8ac8a46e67bb10b7'),
|
|
62
|
+
privateFunctionsRoot: Fr.fromString('0x247aaafc67f6bf5b06736649181a477dac9f18d3468969b14669708c3dabb275'),
|
|
63
|
+
publicBytecodeCommitment: Fr.fromString('0x1d4b1a8f71b8250d4fb65f8e16a4604e9165648279f47d80e024ce2684c4bdfb'),
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const ProtocolContractInitializationHash: Record<ProtocolContractName, Fr> = {
|
|
68
|
+
ContractInstanceRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
69
|
+
ContractClassRegistry: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
70
|
+
FeeJuice: Fr.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const ProtocolContractPrivateFunctions: Record<ProtocolContractName, { selector: FunctionSelector; vkHash: Fr }[]> = {
|
|
74
|
+
ContractInstanceRegistry: [{ selector: FunctionSelector.fromField(Fr.fromString('0x0000000000000000000000000000000000000000000000000000000077cff62f')), vkHash: Fr.fromString('0x08a57d0b4d164c6c8d92da9c3bfe57a4ac1a639ab0a2a0ccb60bbb6bcd37f245') }],
|
|
75
|
+
ContractClassRegistry: [{ selector: FunctionSelector.fromField(Fr.fromString('0x000000000000000000000000000000000000000000000000000000006934ed0d')), vkHash: Fr.fromString('0x1531ed0e20d6d05f1aeb06f746c8c4b8f467174836d6edf915b0c45099b393ed') }],
|
|
76
|
+
FeeJuice: [{ selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000cbe67243')), vkHash: Fr.fromString('0x2dbad42bf59fe7ea908485dea59573b4d7fb8ddefb6a0f73bbcce79aa27d545c') }, { selector: FunctionSelector.fromField(Fr.fromString('0x00000000000000000000000000000000000000000000000000000000e8d374b6')), vkHash: Fr.fromString('0x2e9880e15fb0c9a5494faef915861144769e94aded54c737819ee75918fbda51') }]
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
export const ProtocolContractsList = new ProtocolContracts([
|
|
82
|
+
AztecAddress.fromString('0x20b16259faa0a096d687572fc76221263f1cad4a4b726ef49e2cd7b7ce7c7465'),
|
|
83
|
+
AztecAddress.fromString('0x290f7bf7cea0eb4c440a06dc8bcf825865479348c9ebf8f540b10ad10fd32c44'),
|
|
84
|
+
AztecAddress.fromString('0x0fa3ba3e01e6646cd2adade41018dbfff04e59c444760e33bf773ec43d683019'),
|
|
85
|
+
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
86
|
+
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
87
|
+
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
88
|
+
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
89
|
+
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
90
|
+
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
91
|
+
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000'),
|
|
92
|
+
AztecAddress.fromString('0x0000000000000000000000000000000000000000000000000000000000000000')
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
export const protocolContractsHash = Fr.fromString('0x04194c6dd98d175d07d300b253a9967f5c46782d0e9c3c88473f79ca8b8b16d6');
|
|
54
96
|
|
|
55
97
|
|
|
56
98
|
|
|
57
|
-
export const
|
|
58
|
-
export const REGISTERER_PRIVATE_FUNCTION_BROADCASTED_TAG = Fr.fromHexString('0x0abf338154e355442d9916d630da0491036d5a7b23c42b477c1395ba3bf9b42d');
|
|
59
|
-
export const REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_TAG = Fr.fromHexString('0x27774539896271d6dbe0c1de45ddc44709d1e8d9a9fb686ca3c105d87c417bb8');
|
|
60
|
-
export const DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG = Fr.fromHexString('0x2ec28b91a5f838506d6042915005ff55cf7a0a5f889a83b11faed33a31b486f2');
|
|
61
|
-
export const DEPLOYER_CONTRACT_INSTANCE_UPDATED_TAG = new Fr(1534834688047131268740281708431107902615560100979874281215533519862n);
|
|
99
|
+
export const CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG = Fr.fromHexString('0x1a7e1badb79abdd38c684b3c8306ffe7ecb33c69e3380d9855730aaaa83a21a8');
|
|
62
100
|
|
|
63
101
|
|
package/src/provider/bundle.ts
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { ContractClassRegistererArtifact } from '../class-registerer/index.js';
|
|
3
|
+
import { ContractClassRegistryArtifact } from '../class-registry/index.js';
|
|
5
4
|
import { FeeJuiceArtifact } from '../fee-juice/index.js';
|
|
6
|
-
import {
|
|
5
|
+
import { ContractInstanceRegistryArtifact } from '../instance-registry/index.js';
|
|
7
6
|
import { makeProtocolContract } from '../make_protocol_contract.js';
|
|
8
|
-
import { MultiCallEntrypointArtifact } from '../multi-call-entrypoint/index.js';
|
|
9
7
|
import type { ProtocolContract } from '../protocol_contract.js';
|
|
10
8
|
import type { ProtocolContractName } from '../protocol_contract_data.js';
|
|
11
|
-
import { RouterArtifact } from '../router/index.js';
|
|
12
9
|
import type { ProtocolContractsProvider } from './protocol_contracts_provider.js';
|
|
13
10
|
|
|
14
11
|
export const ProtocolContractArtifact: Record<ProtocolContractName, ContractArtifact> = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
ContractClassRegisterer: ContractClassRegistererArtifact,
|
|
18
|
-
MultiCallEntrypoint: MultiCallEntrypointArtifact,
|
|
12
|
+
ContractInstanceRegistry: ContractInstanceRegistryArtifact,
|
|
13
|
+
ContractClassRegistry: ContractClassRegistryArtifact,
|
|
19
14
|
FeeJuice: FeeJuiceArtifact,
|
|
20
|
-
Router: RouterArtifact,
|
|
21
15
|
};
|
|
22
16
|
|
|
23
17
|
export class BundledProtocolContractsProvider implements ProtocolContractsProvider {
|
|
24
18
|
getProtocolContractArtifact(name: ProtocolContractName): Promise<ProtocolContract> {
|
|
25
|
-
return makeProtocolContract(name, ProtocolContractArtifact[name]);
|
|
19
|
+
return Promise.resolve(makeProtocolContract(name, ProtocolContractArtifact[name]));
|
|
26
20
|
}
|
|
27
21
|
}
|