@aztec/bot 4.3.0-nightly.20260508 → 4.3.0-nightly.20260510
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/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +37 -28
- package/package.json +15 -15
- package/src/factory.ts +28 -28
package/dest/factory.d.ts
CHANGED
|
@@ -61,4 +61,4 @@ export declare class BotFactory {
|
|
|
61
61
|
private bridgeL1FeeJuice;
|
|
62
62
|
private withNoMinTxsPerBlock;
|
|
63
63
|
}
|
|
64
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBb0J6RCxPQUFPLEtBQUssRUFBRSx3QkFBd0IsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBSXRFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUMzRCxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSx1Q0FBdUMsQ0FBQztBQUM3RSxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDL0QsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBRWxFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRixPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFekQsT0FBTyxFQUFFLEtBQUssU0FBUyxFQUEy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E,cAAc,CAAC;QACvB,qBAAqB,EAAE,YAAY,CAAC;QACpC,GAAG,EAAE,WAAW,CAAC;QACjB,MAAM,EAAE,aAAa,CAAC;QACtB,MAAM,EAAE,aAAa,CAAC;QACtB,IAAI,EAAE,SAAS,CAAC;KACjB,CAAC,CAsBD;IAED;;;OAGG;IACU,eAAe,IAAI,OAAO,CAAC;QACtC,MAAM,EAAE,cAAc,CAAC;QACvB,qBAAqB,EAAE,YAAY,CAAC;QACpC,QAAQ,EAAE,YAAY,CAAC;QACvB,IAAI,EAAE,SAAS,CAAC;QAChB,QAAQ,EAAE,wBAAwB,CAAC;QACnC,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC,CA2DD;YAEa,iBAAiB;YAWjB,YAAY;YAWZ,0BAA0B;YAuC1B,gBAAgB;YAehB,UAAU;YAuDV,kBAAkB;YAalB,gBAAgB;YAyBhB,OAAO;YAsFP,wBAAwB;YA0BxB,UAAU;YAgDV,sBAAsB;YA2BtB,gBAAgB;YA+BhB,oBAAoB;CAenC"}
|
package/dest/factory.js
CHANGED
|
@@ -126,11 +126,12 @@ export class BotFactory {
|
|
|
126
126
|
}
|
|
127
127
|
async setupTestContract(deployer) {
|
|
128
128
|
const deployOpts = {
|
|
129
|
-
from: deployer
|
|
130
|
-
contractAddressSalt: this.config.tokenSalt,
|
|
131
|
-
universalDeploy: true
|
|
129
|
+
from: deployer
|
|
132
130
|
};
|
|
133
|
-
const deploy = TestContract.deploy(this.wallet
|
|
131
|
+
const deploy = TestContract.deploy(this.wallet, {
|
|
132
|
+
salt: this.config.tokenSalt,
|
|
133
|
+
universalDeploy: true
|
|
134
|
+
});
|
|
134
135
|
const instance = await this.registerOrDeployContract('TestContract', deploy, deployOpts);
|
|
135
136
|
return TestContract.at(instance.address, this.wallet);
|
|
136
137
|
}
|
|
@@ -195,37 +196,43 @@ export class BotFactory {
|
|
|
195
196
|
* @returns The TokenContract instance.
|
|
196
197
|
*/ async setupToken(sender) {
|
|
197
198
|
let deploy;
|
|
198
|
-
|
|
199
|
+
const salt = this.config.tokenSalt;
|
|
199
200
|
const deployOpts = {
|
|
200
|
-
from: sender
|
|
201
|
-
contractAddressSalt: this.config.tokenSalt,
|
|
202
|
-
universalDeploy: true
|
|
201
|
+
from: sender
|
|
203
202
|
};
|
|
204
203
|
let token;
|
|
204
|
+
let instance;
|
|
205
205
|
if (this.config.contract === SupportedTokenContracts.TokenContract) {
|
|
206
|
-
deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18, {
|
|
207
|
+
salt,
|
|
208
|
+
universalDeploy: true
|
|
209
|
+
});
|
|
210
|
+
instance = await deploy.getInstance();
|
|
211
|
+
token = TokenContract.at(instance.address, this.wallet);
|
|
209
212
|
} else if (this.config.contract === SupportedTokenContracts.PrivateTokenContract) {
|
|
210
213
|
// Generate keys for the contract since PrivateToken uses SinglePrivateMutable which requires keys
|
|
211
214
|
const tokenSecretKey = Fr.random();
|
|
212
215
|
const tokenPublicKeys = (await deriveKeys(tokenSecretKey)).publicKeys;
|
|
213
|
-
deploy = PrivateTokenContract.
|
|
216
|
+
deploy = PrivateTokenContract.deploy(this.wallet, MINT_BALANCE, sender, {
|
|
217
|
+
salt,
|
|
218
|
+
universalDeploy: true,
|
|
219
|
+
publicKeys: tokenPublicKeys
|
|
220
|
+
});
|
|
214
221
|
deployOpts.skipInstancePublication = true;
|
|
215
222
|
deployOpts.skipClassPublication = true;
|
|
216
223
|
deployOpts.skipInitialization = false;
|
|
217
224
|
// Register the contract with the secret key before deployment
|
|
218
|
-
|
|
219
|
-
token = PrivateTokenContract.at(
|
|
220
|
-
await this.wallet.registerContract(
|
|
225
|
+
instance = await deploy.getInstance();
|
|
226
|
+
token = PrivateTokenContract.at(instance.address, this.wallet);
|
|
227
|
+
await this.wallet.registerContract(instance, PrivateTokenContract.artifact, tokenSecretKey);
|
|
221
228
|
// The contract constructor initializes private storage vars that need the contract's own nullifier key.
|
|
222
229
|
deployOpts.additionalScopes = [
|
|
223
|
-
|
|
230
|
+
instance.address
|
|
224
231
|
];
|
|
225
232
|
} else {
|
|
226
233
|
throw new Error(`Unsupported token contract type: ${this.config.contract}`);
|
|
227
234
|
}
|
|
228
|
-
const address =
|
|
235
|
+
const address = instance.address;
|
|
229
236
|
const metadata = await this.wallet.getContractMetadata(address);
|
|
230
237
|
if (metadata.isContractPublished) {
|
|
231
238
|
this.log.info(`Token at ${address.toString()} already deployed`);
|
|
@@ -250,23 +257,25 @@ export class BotFactory {
|
|
|
250
257
|
* Checks if the token contract is deployed and deploys it if necessary.
|
|
251
258
|
* @param wallet - Wallet to deploy the token contract from.
|
|
252
259
|
* @returns The TokenContract instance.
|
|
253
|
-
*/ async setupTokenContract(deployer,
|
|
260
|
+
*/ async setupTokenContract(deployer, salt, name, ticker, decimals = 18) {
|
|
254
261
|
const deployOpts = {
|
|
255
|
-
from: deployer
|
|
256
|
-
contractAddressSalt,
|
|
257
|
-
universalDeploy: true
|
|
262
|
+
from: deployer
|
|
258
263
|
};
|
|
259
|
-
const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals
|
|
264
|
+
const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals, {
|
|
265
|
+
salt,
|
|
266
|
+
universalDeploy: true
|
|
267
|
+
});
|
|
260
268
|
const instance = await this.registerOrDeployContract('Token - ' + name, deploy, deployOpts);
|
|
261
269
|
return TokenContract.at(instance.address, this.wallet);
|
|
262
270
|
}
|
|
263
|
-
async setupAmmContract(deployer,
|
|
271
|
+
async setupAmmContract(deployer, salt, token0, token1, lpToken) {
|
|
264
272
|
const deployOpts = {
|
|
265
|
-
from: deployer
|
|
266
|
-
contractAddressSalt,
|
|
267
|
-
universalDeploy: true
|
|
273
|
+
from: deployer
|
|
268
274
|
};
|
|
269
|
-
const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address
|
|
275
|
+
const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address, {
|
|
276
|
+
salt,
|
|
277
|
+
universalDeploy: true
|
|
278
|
+
});
|
|
270
279
|
const instance = await this.registerOrDeployContract('AMM', deploy, deployOpts);
|
|
271
280
|
const amm = AMMContract.at(instance.address, this.wallet);
|
|
272
281
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
@@ -335,7 +344,7 @@ export class BotFactory {
|
|
|
335
344
|
this.log.info(`Updated private balances of ${defaultAccountAddress} after minting and funding AMM: token0=${newT0Bal}, token1=${newT1Bal}, lp=${newLPBal}`);
|
|
336
345
|
}
|
|
337
346
|
async registerOrDeployContract(name, deploy, deployOpts) {
|
|
338
|
-
const instance = await deploy.getInstance(
|
|
347
|
+
const instance = await deploy.getInstance();
|
|
339
348
|
const address = instance.address;
|
|
340
349
|
const metadata = await this.wallet.getContractMetadata(address);
|
|
341
350
|
if (metadata.isContractPublished) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/bot",
|
|
3
|
-
"version": "4.3.0-nightly.
|
|
3
|
+
"version": "4.3.0-nightly.20260510",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -54,20 +54,20 @@
|
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@aztec/accounts": "4.3.0-nightly.
|
|
58
|
-
"@aztec/aztec.js": "4.3.0-nightly.
|
|
59
|
-
"@aztec/entrypoints": "4.3.0-nightly.
|
|
60
|
-
"@aztec/ethereum": "4.3.0-nightly.
|
|
61
|
-
"@aztec/foundation": "4.3.0-nightly.
|
|
62
|
-
"@aztec/kv-store": "4.3.0-nightly.
|
|
63
|
-
"@aztec/l1-artifacts": "4.3.0-nightly.
|
|
64
|
-
"@aztec/noir-contracts.js": "4.3.0-nightly.
|
|
65
|
-
"@aztec/noir-protocol-circuits-types": "4.3.0-nightly.
|
|
66
|
-
"@aztec/noir-test-contracts.js": "4.3.0-nightly.
|
|
67
|
-
"@aztec/protocol-contracts": "4.3.0-nightly.
|
|
68
|
-
"@aztec/stdlib": "4.3.0-nightly.
|
|
69
|
-
"@aztec/telemetry-client": "4.3.0-nightly.
|
|
70
|
-
"@aztec/wallets": "4.3.0-nightly.
|
|
57
|
+
"@aztec/accounts": "4.3.0-nightly.20260510",
|
|
58
|
+
"@aztec/aztec.js": "4.3.0-nightly.20260510",
|
|
59
|
+
"@aztec/entrypoints": "4.3.0-nightly.20260510",
|
|
60
|
+
"@aztec/ethereum": "4.3.0-nightly.20260510",
|
|
61
|
+
"@aztec/foundation": "4.3.0-nightly.20260510",
|
|
62
|
+
"@aztec/kv-store": "4.3.0-nightly.20260510",
|
|
63
|
+
"@aztec/l1-artifacts": "4.3.0-nightly.20260510",
|
|
64
|
+
"@aztec/noir-contracts.js": "4.3.0-nightly.20260510",
|
|
65
|
+
"@aztec/noir-protocol-circuits-types": "4.3.0-nightly.20260510",
|
|
66
|
+
"@aztec/noir-test-contracts.js": "4.3.0-nightly.20260510",
|
|
67
|
+
"@aztec/protocol-contracts": "4.3.0-nightly.20260510",
|
|
68
|
+
"@aztec/stdlib": "4.3.0-nightly.20260510",
|
|
69
|
+
"@aztec/telemetry-client": "4.3.0-nightly.20260510",
|
|
70
|
+
"@aztec/wallets": "4.3.0-nightly.20260510",
|
|
71
71
|
"source-map-support": "^0.5.21",
|
|
72
72
|
"tslib": "^2.4.0",
|
|
73
73
|
"viem": "npm:@aztec/viem@2.38.2",
|
package/src/factory.ts
CHANGED
|
@@ -178,12 +178,8 @@ export class BotFactory {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
private async setupTestContract(deployer: AztecAddress): Promise<TestContract> {
|
|
181
|
-
const deployOpts: DeployOptions = {
|
|
182
|
-
|
|
183
|
-
contractAddressSalt: this.config.tokenSalt,
|
|
184
|
-
universalDeploy: true,
|
|
185
|
-
};
|
|
186
|
-
const deploy = TestContract.deploy(this.wallet);
|
|
181
|
+
const deployOpts: DeployOptions = { from: deployer };
|
|
182
|
+
const deploy = TestContract.deploy(this.wallet, { salt: this.config.tokenSalt, universalDeploy: true });
|
|
187
183
|
const instance = await this.registerOrDeployContract('TestContract', deploy, deployOpts);
|
|
188
184
|
return TestContract.at(instance.address, this.wallet);
|
|
189
185
|
}
|
|
@@ -259,37 +255,38 @@ export class BotFactory {
|
|
|
259
255
|
*/
|
|
260
256
|
private async setupToken(sender: AztecAddress): Promise<TokenContract | PrivateTokenContract> {
|
|
261
257
|
let deploy: DeployMethod<TokenContract | PrivateTokenContract>;
|
|
262
|
-
|
|
263
|
-
const deployOpts: DeployOptions = {
|
|
264
|
-
from: sender,
|
|
265
|
-
contractAddressSalt: this.config.tokenSalt,
|
|
266
|
-
universalDeploy: true,
|
|
267
|
-
};
|
|
258
|
+
const salt = this.config.tokenSalt;
|
|
259
|
+
const deployOpts: DeployOptions = { from: sender };
|
|
268
260
|
let token: TokenContract | PrivateTokenContract;
|
|
261
|
+
let instance: ContractInstanceWithAddress;
|
|
269
262
|
if (this.config.contract === SupportedTokenContracts.TokenContract) {
|
|
270
|
-
deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18);
|
|
271
|
-
|
|
272
|
-
token = TokenContract.at(
|
|
263
|
+
deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18, { salt, universalDeploy: true });
|
|
264
|
+
instance = await deploy.getInstance();
|
|
265
|
+
token = TokenContract.at(instance.address, this.wallet);
|
|
273
266
|
} else if (this.config.contract === SupportedTokenContracts.PrivateTokenContract) {
|
|
274
267
|
// Generate keys for the contract since PrivateToken uses SinglePrivateMutable which requires keys
|
|
275
268
|
const tokenSecretKey = Fr.random();
|
|
276
269
|
const tokenPublicKeys = (await deriveKeys(tokenSecretKey)).publicKeys;
|
|
277
|
-
deploy = PrivateTokenContract.
|
|
270
|
+
deploy = PrivateTokenContract.deploy(this.wallet, MINT_BALANCE, sender, {
|
|
271
|
+
salt,
|
|
272
|
+
universalDeploy: true,
|
|
273
|
+
publicKeys: tokenPublicKeys,
|
|
274
|
+
});
|
|
278
275
|
deployOpts.skipInstancePublication = true;
|
|
279
276
|
deployOpts.skipClassPublication = true;
|
|
280
277
|
deployOpts.skipInitialization = false;
|
|
281
278
|
|
|
282
279
|
// Register the contract with the secret key before deployment
|
|
283
|
-
|
|
284
|
-
token = PrivateTokenContract.at(
|
|
285
|
-
await this.wallet.registerContract(
|
|
280
|
+
instance = await deploy.getInstance();
|
|
281
|
+
token = PrivateTokenContract.at(instance.address, this.wallet);
|
|
282
|
+
await this.wallet.registerContract(instance, PrivateTokenContract.artifact, tokenSecretKey);
|
|
286
283
|
// The contract constructor initializes private storage vars that need the contract's own nullifier key.
|
|
287
|
-
deployOpts.additionalScopes = [
|
|
284
|
+
deployOpts.additionalScopes = [instance.address];
|
|
288
285
|
} else {
|
|
289
286
|
throw new Error(`Unsupported token contract type: ${this.config.contract}`);
|
|
290
287
|
}
|
|
291
288
|
|
|
292
|
-
const address =
|
|
289
|
+
const address = instance.address;
|
|
293
290
|
const metadata = await this.wallet.getContractMetadata(address);
|
|
294
291
|
if (metadata.isContractPublished) {
|
|
295
292
|
this.log.info(`Token at ${address.toString()} already deployed`);
|
|
@@ -313,26 +310,29 @@ export class BotFactory {
|
|
|
313
310
|
*/
|
|
314
311
|
private async setupTokenContract(
|
|
315
312
|
deployer: AztecAddress,
|
|
316
|
-
|
|
313
|
+
salt: Fr,
|
|
317
314
|
name: string,
|
|
318
315
|
ticker: string,
|
|
319
316
|
decimals = 18,
|
|
320
317
|
): Promise<TokenContract> {
|
|
321
|
-
const deployOpts: DeployOptions = { from: deployer
|
|
322
|
-
const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals);
|
|
318
|
+
const deployOpts: DeployOptions = { from: deployer };
|
|
319
|
+
const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals, { salt, universalDeploy: true });
|
|
323
320
|
const instance = await this.registerOrDeployContract('Token - ' + name, deploy, deployOpts);
|
|
324
321
|
return TokenContract.at(instance.address, this.wallet);
|
|
325
322
|
}
|
|
326
323
|
|
|
327
324
|
private async setupAmmContract(
|
|
328
325
|
deployer: AztecAddress,
|
|
329
|
-
|
|
326
|
+
salt: Fr,
|
|
330
327
|
token0: TokenContract,
|
|
331
328
|
token1: TokenContract,
|
|
332
329
|
lpToken: TokenContract,
|
|
333
330
|
): Promise<AMMContract> {
|
|
334
|
-
const deployOpts: DeployOptions = { from: deployer
|
|
335
|
-
const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address
|
|
331
|
+
const deployOpts: DeployOptions = { from: deployer };
|
|
332
|
+
const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address, {
|
|
333
|
+
salt,
|
|
334
|
+
universalDeploy: true,
|
|
335
|
+
});
|
|
336
336
|
const instance = await this.registerOrDeployContract('AMM', deploy, deployOpts);
|
|
337
337
|
const amm = AMMContract.at(instance.address, this.wallet);
|
|
338
338
|
|
|
@@ -437,7 +437,7 @@ export class BotFactory {
|
|
|
437
437
|
deploy: DeployMethod<T>,
|
|
438
438
|
deployOpts: DeployOptions,
|
|
439
439
|
): Promise<ContractInstanceWithAddress> {
|
|
440
|
-
const instance = await deploy.getInstance(
|
|
440
|
+
const instance = await deploy.getInstance();
|
|
441
441
|
const address = instance.address;
|
|
442
442
|
const metadata = await this.wallet.getContractMetadata(address);
|
|
443
443
|
if (metadata.isContractPublished) {
|