@aztec/protocol-contracts 0.35.1 → 0.37.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.
- package/dest/artifacts/ContractClassRegisterer.json +1 -1
- package/dest/artifacts/ContractInstanceDeployer.json +1 -1
- package/dest/artifacts/GasToken.json +1 -1
- package/dest/artifacts/KeyRegistry.json +1 -0
- package/dest/artifacts/MultiCallEntrypoint.json +1 -1
- package/dest/gas-token/index.d.ts.map +1 -1
- package/dest/gas-token/index.js +2 -3
- package/dest/instance-deployer/index.d.ts.map +1 -1
- package/dest/instance-deployer/index.js +6 -2
- package/dest/key-registry/artifact.d.ts +2 -0
- package/dest/key-registry/artifact.d.ts.map +1 -0
- package/dest/key-registry/artifact.js +4 -0
- package/dest/key-registry/index.d.ts +7 -0
- package/dest/key-registry/index.d.ts.map +1 -0
- package/dest/key-registry/index.js +16 -0
- package/dest/multi-call-entrypoint/index.d.ts.map +1 -1
- package/dest/multi-call-entrypoint/index.js +2 -3
- package/dest/protocol_contract.d.ts +3 -3
- package/dest/protocol_contract.d.ts.map +1 -1
- package/dest/protocol_contract.js +4 -6
- package/package.json +12 -4
- package/src/artifacts/ContractClassRegisterer.json +1 -1
- package/src/artifacts/ContractInstanceDeployer.json +1 -1
- package/src/artifacts/GasToken.json +1 -1
- package/src/artifacts/KeyRegistry.json +1 -0
- package/src/artifacts/MultiCallEntrypoint.json +1 -1
- package/src/gas-token/index.ts +2 -2
- package/src/instance-deployer/index.ts +7 -1
- package/src/key-registry/artifact.ts +6 -0
- package/src/key-registry/index.ts +22 -0
- package/src/multi-call-entrypoint/index.ts +2 -2
- package/src/protocol_contract.ts +1 -6
package/src/gas-token/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type AztecAddress, type EthAddress
|
|
1
|
+
import { type AztecAddress, type EthAddress } from '@aztec/circuits.js';
|
|
2
2
|
|
|
3
3
|
import { type ProtocolContract, getCanonicalProtocolContract } from '../protocol_contract.js';
|
|
4
4
|
import { GasTokenArtifact } from './artifact.js';
|
|
5
5
|
|
|
6
6
|
/** Returns the canonical deployment of the gas token. */
|
|
7
7
|
export function getCanonicalGasToken(l1Bridge: EthAddress): ProtocolContract {
|
|
8
|
-
return getCanonicalProtocolContract(GasTokenArtifact, 1, []
|
|
8
|
+
return getCanonicalProtocolContract(GasTokenArtifact, 1, [l1Bridge]);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function getCanonicalGasTokenAddress(l1Bridge: EthAddress): AztecAddress {
|
|
@@ -5,7 +5,13 @@ import { ContractInstanceDeployerArtifact } from './artifact.js';
|
|
|
5
5
|
|
|
6
6
|
/** Returns the canonical deployment of the instance deployer contract. */
|
|
7
7
|
export function getCanonicalInstanceDeployer(): ProtocolContract {
|
|
8
|
-
|
|
8
|
+
const contract = getCanonicalProtocolContract(ContractInstanceDeployerArtifact, 1);
|
|
9
|
+
if (!contract.address.equals(InstanceDeployerAddress)) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
`Incorrect address for contract deployer (got ${contract.address.toString()} but expected ${InstanceDeployerAddress.toString()}). Check DEPLOYER_CONTRACT_ADDRESS is set to the correct value in the constants files and run the protocol-contracts package tests.`,
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return contract;
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
export const InstanceDeployerAddress = AztecAddress.fromBigInt(DEPLOYER_CONTRACT_ADDRESS);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { loadContractArtifact } from '@aztec/types/abi';
|
|
2
|
+
import { type NoirCompiledContract } from '@aztec/types/noir';
|
|
3
|
+
|
|
4
|
+
import KeyRegistryJson from '../artifacts/KeyRegistry.json' assert { type: 'json' };
|
|
5
|
+
|
|
6
|
+
export const KeyRegistryArtifact = loadContractArtifact(KeyRegistryJson as NoirCompiledContract);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AztecAddress, CANONICAL_KEY_REGISTRY_ADDRESS } from '@aztec/circuits.js';
|
|
2
|
+
|
|
3
|
+
import { type ProtocolContract, getCanonicalProtocolContract } from '../protocol_contract.js';
|
|
4
|
+
import { KeyRegistryArtifact } from './artifact.js';
|
|
5
|
+
|
|
6
|
+
/** Returns the canonical deployment of the public key registry. */
|
|
7
|
+
export function getCanonicalKeyRegistry(): ProtocolContract {
|
|
8
|
+
const contract = getCanonicalProtocolContract(KeyRegistryArtifact, 1);
|
|
9
|
+
|
|
10
|
+
if (!contract.address.equals(KeyRegistryAddress)) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
`Incorrect address for key registry (got ${contract.address.toString()} but expected ${KeyRegistryAddress.toString()}). Check CANONICAL_KEY_REGISTRY_ADDRESS is set to the correct value in the constants files and run the protocol-contracts package tests.`,
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
return contract;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function getCanonicalKeyRegistryAddress(): AztecAddress {
|
|
19
|
+
return getCanonicalKeyRegistry().address;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const KeyRegistryAddress = AztecAddress.fromBigInt(CANONICAL_KEY_REGISTRY_ADDRESS);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type AztecAddress
|
|
1
|
+
import { type AztecAddress } from '@aztec/circuits.js';
|
|
2
2
|
|
|
3
3
|
import { type ProtocolContract, getCanonicalProtocolContract } from '../protocol_contract.js';
|
|
4
4
|
import { MultiCallEntrypointArtifact } from './artifact.js';
|
|
5
5
|
|
|
6
6
|
export function getCanonicalMultiCallEntrypointContract(): ProtocolContract {
|
|
7
|
-
return getCanonicalProtocolContract(MultiCallEntrypointArtifact, 1, []
|
|
7
|
+
return getCanonicalProtocolContract(MultiCallEntrypointArtifact, 1, []);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function getCanonicalMultiCallEntrypointAddress(): AztecAddress {
|
package/src/protocol_contract.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type AztecAddress,
|
|
3
|
-
EthAddress,
|
|
4
3
|
getContractClassFromArtifact,
|
|
5
4
|
getContractInstanceFromDeployParams,
|
|
6
5
|
} from '@aztec/circuits.js';
|
|
7
6
|
import { type ContractArtifact } from '@aztec/foundation/abi';
|
|
8
|
-
import { Fr
|
|
7
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
9
8
|
import { type ContractClassWithId, type ContractInstanceWithAddress } from '@aztec/types/contracts';
|
|
10
9
|
|
|
11
10
|
/** Represents a canonical contract in the protocol. */
|
|
@@ -25,16 +24,12 @@ export function getCanonicalProtocolContract(
|
|
|
25
24
|
artifact: ContractArtifact,
|
|
26
25
|
salt: Fr | number | bigint,
|
|
27
26
|
constructorArgs: any[] = [],
|
|
28
|
-
publicKey: Point = Point.ZERO,
|
|
29
|
-
portalAddress = EthAddress.ZERO,
|
|
30
27
|
): ProtocolContract {
|
|
31
28
|
// TODO(@spalladino): This computes the contract class from the artifact twice.
|
|
32
29
|
const contractClass = getContractClassFromArtifact(artifact);
|
|
33
30
|
const instance = getContractInstanceFromDeployParams(artifact, {
|
|
34
31
|
constructorArgs,
|
|
35
32
|
salt: new Fr(salt),
|
|
36
|
-
publicKey,
|
|
37
|
-
portalAddress,
|
|
38
33
|
});
|
|
39
34
|
return {
|
|
40
35
|
instance,
|