@aztec/bot 0.0.1-commit.381b1a9 → 0.0.1-commit.3a4ae741b
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/config.d.ts +3 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +1 -2
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +108 -18
- package/package.json +15 -15
- package/src/config.ts +1 -2
- package/src/factory.ts +74 -27
package/dest/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ConfigMappingsType, SecretValue } from '@aztec/foundation/config';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { type DataStoreConfig } from '@aztec/kv-store
|
|
3
|
+
import { type DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
4
4
|
import type { ComponentsVersions } from '@aztec/stdlib/versioning';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
declare const BotFollowChain: readonly ["NONE", "PROPOSED", "CHECKPOINTED", "PROVEN"];
|
|
@@ -176,6 +176,7 @@ export declare const BotConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
176
176
|
botMode: "amm" | "crosschain" | "transfer";
|
|
177
177
|
l2ToL1MessagesPerTx: number;
|
|
178
178
|
l1ToL2SeedCount: number;
|
|
179
|
+
dataDirectory?: string | undefined;
|
|
179
180
|
nodeUrl: string | undefined;
|
|
180
181
|
nodeAdminUrl: string | undefined;
|
|
181
182
|
l1RpcUrls: string[] | undefined;
|
|
@@ -185,7 +186,6 @@ export declare const BotConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
185
186
|
l1Mnemonic: SecretValue<string> | undefined;
|
|
186
187
|
l1PrivateKey: SecretValue<string> | undefined;
|
|
187
188
|
senderPrivateKey: SecretValue<Fr> | undefined;
|
|
188
|
-
dataDirectory: string | undefined;
|
|
189
189
|
dataStoreMapSizeKb: number;
|
|
190
190
|
}, {
|
|
191
191
|
nodeUrl?: string | undefined;
|
|
@@ -223,4 +223,4 @@ export declare function getBotConfigFromEnv(): BotConfig;
|
|
|
223
223
|
export declare function getBotDefaultConfig(): BotConfig;
|
|
224
224
|
export declare function getVersions(): Partial<ComponentsVersions>;
|
|
225
225
|
export {};
|
|
226
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
226
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLGtCQUFrQixFQUN2QixXQUFXLEVBU1osTUFBTSwwQkFBMEIsQ0FBQztBQUNsQyxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFHcEQsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFzQixNQUFNLHdCQUF3QixDQUFDO0FBRWxGLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFFbkUsT0FBTyxFQUFFLENBQUMsRUFBRSxNQUFNLEtBQUssQ0FBQztBQUV4QixRQUFBLE1BQU0sY0FBYyx5REFBMEQsQ0FBQztBQUMvRSxLQUFLLGNBQWMsR0FBRyxDQUFDLE9BQU8sY0FBYyxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUM7QUFFdEQsUUFBQSxNQUFNLE9BQU8sNENBQTZDLENBQUM7QUFDM0QsS0FBSyxPQUFPLEdBQUcsQ0FBQyxPQUFPLE9BQU8sQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBRXhDLG9CQUFZLHVCQUF1QjtJQUNqQyxhQUFhLGtCQUFrQjtJQUMvQixvQkFBb0IseUJBQXlCO0NBQzlDO0FBRUQsTUFBTSxNQUFNLFNBQVMs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FBQztBQUVGLHdCQUFnQixtQkFBbUIsSUFBSSxTQUFTLENBRS9DO0FBRUQsd0JBQWdCLG1CQUFtQixJQUFJLFNBQVMsQ0FFL0M7QUFFRCx3QkFBZ0IsV0FBVyxJQUFJLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUt6RCJ9
|
package/dest/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,EASZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,EASZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,cAAc,yDAA0D,CAAC;AAC/E,KAAK,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,QAAA,MAAM,OAAO,4CAA6C,CAAC;AAC3D,KAAK,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAExC,oBAAY,uBAAuB;IACjC,aAAa,kBAAkB;IAC/B,oBAAoB,yBAAyB;CAC9C;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,4EAA4E;IAC5E,YAAY,EAAE,MAAM,GAAG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AAC;IACjB,2DAAyD;IACzD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gEAA8D;IAC9D,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8C3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,SAAS,CAmK3D,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,SAAS,CAE/C;AAED,wBAAgB,mBAAmB,IAAI,SAAS,CAE/C;AAED,wBAAgB,WAAW,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAKzD"}
|
package/dest/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { booleanConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper, optionalNumberConfigHelper, pickConfigMappings, secretFrConfigHelper, secretStringConfigHelper } from '@aztec/foundation/config';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
4
3
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
5
4
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
5
|
+
import { dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
6
6
|
import { schemas, zodFor } from '@aztec/stdlib/schemas';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
const BotFollowChain = [
|
|
@@ -61,7 +61,6 @@ export const BotConfigSchema = zodFor()(z.object({
|
|
|
61
61
|
l1Mnemonic: undefined,
|
|
62
62
|
l1PrivateKey: undefined,
|
|
63
63
|
senderPrivateKey: undefined,
|
|
64
|
-
dataDirectory: undefined,
|
|
65
64
|
dataStoreMapSizeKb: 1_024 * 1_024,
|
|
66
65
|
...config
|
|
67
66
|
})));
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBb0J6RCxPQUFPLEtBQUssRUFBRSx3QkFBd0IsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBSXRFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUMzRCxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSx1Q0FBdUMsQ0FBQztBQUM3RSxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDL0QsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBR2xFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRixPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFekQsT0FBTyxFQUFFLEtBQUssU0FBUyxFQUEyQixNQUFNLGFBQWEsQ0FBQztBQUV0RSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQU1qRCxxQkF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HFCQUFxQixFQUFFLFlBQVksQ0FBQztRQUNwQyxRQUFRLEVBQUUsWUFBWSxDQUFDO1FBQ3ZCLElBQUksRUFBRSxTQUFTLENBQUM7UUFDaEIsUUFBUSxFQUFFLHdCQUF3QixDQUFDO1FBQ25DLGFBQWEsRUFBRSxNQUFNLENBQUM7S0FDdkIsQ0FBQyxDQTJERDtZQUVhLGlCQUFpQjtZQWVqQixZQUFZO1lBV1osMEJBQTBCO1lBOEMxQixnQkFBZ0I7WUFlaEIsVUFBVTtZQXVEVixrQkFBa0I7WUFhbEIsZ0JBQWdCO1lBK0JoQixPQUFPO1lBNEdQLHdCQUF3QjtZQTJCeEIsVUFBVTtZQW1EVixzQkFBc0I7WUEyQnRCLGdCQUFnQjtZQStCaEIsb0JBQW9CO0NBZW5DIn0=
|
package/dest/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAoBzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAItE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGlE,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,aAAa,CAAC;AAEtE,OAAO,KAAK,EAAE,QAAQ,EAAE,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YA4GP,wBAAwB;YA2BxB,UAAU;YAmDV,sBAAsB;YA2BtB,gBAAgB;YA+BhB,oBAAoB;CAenC"}
|
package/dest/factory.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
-
import {
|
|
2
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
3
3
|
import { BatchCall, NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
4
4
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
5
5
|
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
@@ -7,6 +7,7 @@ import { deriveKeys } from '@aztec/aztec.js/keys';
|
|
|
7
7
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
8
8
|
import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
|
|
9
9
|
import { waitForTx } from '@aztec/aztec.js/node';
|
|
10
|
+
import { ContractInitializationStatus } from '@aztec/aztec.js/wallet';
|
|
10
11
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
11
12
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
12
13
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
@@ -17,7 +18,7 @@ import { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
|
17
18
|
import { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
18
19
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
19
20
|
import { TestContract } from '@aztec/noir-test-contracts.js/Test';
|
|
20
|
-
import { GasSettings } from '@aztec/stdlib/gas';
|
|
21
|
+
import { GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
21
22
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
22
23
|
import { SupportedTokenContracts } from './config.js';
|
|
23
24
|
import { seedL1ToL2Message } from './l1_to_l2_seeding.js';
|
|
@@ -38,6 +39,9 @@ export class BotFactory {
|
|
|
38
39
|
this.aztecNode = aztecNode;
|
|
39
40
|
this.aztecNodeAdmin = aztecNodeAdmin;
|
|
40
41
|
this.log = createLogger('bot');
|
|
42
|
+
// Set fee padding on the wallet so that all transactions during setup
|
|
43
|
+
// (token deploy, minting, etc.) use the configured padding, not the default.
|
|
44
|
+
this.wallet.setMinFeePadding(config.minFeePadding);
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* Initializes a new bot by setting up the sender account, registering the recipient,
|
|
@@ -149,7 +153,7 @@ export class BotFactory {
|
|
|
149
153
|
const signingKey = deriveSigningKey(secret);
|
|
150
154
|
const accountManager = await this.wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
151
155
|
const metadata = await this.wallet.getContractMetadata(accountManager.address);
|
|
152
|
-
if (metadata.
|
|
156
|
+
if (metadata.initializationStatus === ContractInitializationStatus.INITIALIZED) {
|
|
153
157
|
this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
|
|
154
158
|
const timer = new Timer();
|
|
155
159
|
const address = accountManager.address;
|
|
@@ -163,19 +167,30 @@ export class BotFactory {
|
|
|
163
167
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
|
|
164
168
|
const deployMethod = await accountManager.getDeployMethod();
|
|
165
169
|
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
|
|
166
|
-
const
|
|
167
|
-
|
|
170
|
+
const { estimatedGas } = await deployMethod.simulate({
|
|
171
|
+
from: NO_FROM,
|
|
172
|
+
fee: {
|
|
173
|
+
estimateGas: true,
|
|
174
|
+
paymentMethod
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
const gasSettings = GasSettings.from({
|
|
178
|
+
...estimatedGas,
|
|
179
|
+
maxFeesPerGas,
|
|
180
|
+
maxPriorityFeesPerGas: GasFees.empty()
|
|
168
181
|
});
|
|
169
182
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
170
183
|
const { txHash } = await deployMethod.send({
|
|
171
|
-
from:
|
|
184
|
+
from: NO_FROM,
|
|
172
185
|
fee: {
|
|
173
186
|
gasSettings,
|
|
174
187
|
paymentMethod
|
|
175
188
|
},
|
|
176
189
|
wait: NO_WAIT
|
|
177
190
|
});
|
|
178
|
-
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}
|
|
191
|
+
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`, {
|
|
192
|
+
gasSettings
|
|
193
|
+
});
|
|
179
194
|
return waitForTx(this.aztecNode, txHash, {
|
|
180
195
|
timeout: this.config.txMinedWaitSeconds
|
|
181
196
|
});
|
|
@@ -234,11 +249,22 @@ export class BotFactory {
|
|
|
234
249
|
await deploy.register();
|
|
235
250
|
} else {
|
|
236
251
|
this.log.info(`Deploying token contract at ${address.toString()}`);
|
|
252
|
+
const { estimatedGas } = await deploy.simulate({
|
|
253
|
+
...deployOpts,
|
|
254
|
+
fee: {
|
|
255
|
+
estimateGas: true
|
|
256
|
+
}
|
|
257
|
+
});
|
|
237
258
|
const { txHash } = await deploy.send({
|
|
238
259
|
...deployOpts,
|
|
260
|
+
fee: {
|
|
261
|
+
gasSettings: estimatedGas
|
|
262
|
+
},
|
|
239
263
|
wait: NO_WAIT
|
|
240
264
|
});
|
|
241
|
-
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}
|
|
265
|
+
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`, {
|
|
266
|
+
estimatedGas
|
|
267
|
+
});
|
|
242
268
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
243
269
|
await waitForTx(this.aztecNode, txHash, {
|
|
244
270
|
timeout: this.config.txMinedWaitSeconds
|
|
@@ -272,13 +298,25 @@ export class BotFactory {
|
|
|
272
298
|
const instance = await this.registerOrDeployContract('AMM', deploy, deployOpts);
|
|
273
299
|
const amm = AMMContract.at(instance.address, this.wallet);
|
|
274
300
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
275
|
-
const
|
|
301
|
+
const setMinterInteraction = lpToken.methods.set_minter(amm.address, true);
|
|
302
|
+
const { estimatedGas: setMinterGas } = await setMinterInteraction.simulate({
|
|
276
303
|
from: deployer,
|
|
304
|
+
fee: {
|
|
305
|
+
estimateGas: true
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
const { receipt: minterReceipt } = await setMinterInteraction.send({
|
|
309
|
+
from: deployer,
|
|
310
|
+
fee: {
|
|
311
|
+
gasSettings: setMinterGas
|
|
312
|
+
},
|
|
277
313
|
wait: {
|
|
278
314
|
timeout: this.config.txMinedWaitSeconds
|
|
279
315
|
}
|
|
280
316
|
});
|
|
281
|
-
this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}
|
|
317
|
+
this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}`, {
|
|
318
|
+
estimatedGas: setMinterGas
|
|
319
|
+
});
|
|
282
320
|
this.log.info(`Liquidity token initialized`);
|
|
283
321
|
return amm;
|
|
284
322
|
}
|
|
@@ -311,18 +349,44 @@ export class BotFactory {
|
|
|
311
349
|
caller: amm.address,
|
|
312
350
|
call: await token1.methods.transfer_to_public_and_prepare_private_balance_increase(liquidityProvider, amm.address, amount1Max, authwitNonce).getFunctionCall()
|
|
313
351
|
});
|
|
314
|
-
const
|
|
352
|
+
const mintBatch = new BatchCall(this.wallet, [
|
|
315
353
|
token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
316
354
|
token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE)
|
|
317
|
-
])
|
|
355
|
+
]);
|
|
356
|
+
const { estimatedGas: mintGas } = await mintBatch.simulate({
|
|
357
|
+
from: liquidityProvider,
|
|
358
|
+
fee: {
|
|
359
|
+
estimateGas: true
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
const { receipt: mintReceipt } = await mintBatch.send({
|
|
318
363
|
from: liquidityProvider,
|
|
364
|
+
fee: {
|
|
365
|
+
gasSettings: mintGas
|
|
366
|
+
},
|
|
319
367
|
wait: {
|
|
320
368
|
timeout: this.config.txMinedWaitSeconds
|
|
321
369
|
}
|
|
322
370
|
});
|
|
323
|
-
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}
|
|
324
|
-
|
|
371
|
+
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}`, {
|
|
372
|
+
estimatedGas: mintGas
|
|
373
|
+
});
|
|
374
|
+
const addLiquidityInteraction = amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce);
|
|
375
|
+
const { estimatedGas: addLiquidityGas } = await addLiquidityInteraction.simulate({
|
|
325
376
|
from: liquidityProvider,
|
|
377
|
+
fee: {
|
|
378
|
+
estimateGas: true
|
|
379
|
+
},
|
|
380
|
+
authWitnesses: [
|
|
381
|
+
token0Authwit,
|
|
382
|
+
token1Authwit
|
|
383
|
+
]
|
|
384
|
+
});
|
|
385
|
+
const { receipt: addLiquidityReceipt } = await addLiquidityInteraction.send({
|
|
386
|
+
from: liquidityProvider,
|
|
387
|
+
fee: {
|
|
388
|
+
gasSettings: addLiquidityGas
|
|
389
|
+
},
|
|
326
390
|
authWitnesses: [
|
|
327
391
|
token0Authwit,
|
|
328
392
|
token1Authwit
|
|
@@ -331,7 +395,9 @@ export class BotFactory {
|
|
|
331
395
|
timeout: this.config.txMinedWaitSeconds
|
|
332
396
|
}
|
|
333
397
|
});
|
|
334
|
-
this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}
|
|
398
|
+
this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}`, {
|
|
399
|
+
estimatedGas: addLiquidityGas
|
|
400
|
+
});
|
|
335
401
|
this.log.info(`Liquidity added`);
|
|
336
402
|
const [newT0Bal, newT1Bal, newLPBal] = await getPrivateBalances();
|
|
337
403
|
this.log.info(`Updated private balances of ${defaultAccountAddress} after minting and funding AMM: token0=${newT0Bal}, token1=${newT1Bal}, lp=${newLPBal}`);
|
|
@@ -344,10 +410,21 @@ export class BotFactory {
|
|
|
344
410
|
this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
|
|
345
411
|
await deploy.register();
|
|
346
412
|
} else {
|
|
347
|
-
|
|
413
|
+
const { estimatedGas } = await deploy.simulate({
|
|
414
|
+
...deployOpts,
|
|
415
|
+
fee: {
|
|
416
|
+
estimateGas: true
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
this.log.info(`Deploying contract ${name} at ${address.toString()}`, {
|
|
420
|
+
estimatedGas
|
|
421
|
+
});
|
|
348
422
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
349
423
|
const { txHash } = await deploy.send({
|
|
350
424
|
...deployOpts,
|
|
425
|
+
fee: {
|
|
426
|
+
gasSettings: estimatedGas
|
|
427
|
+
},
|
|
351
428
|
wait: NO_WAIT
|
|
352
429
|
});
|
|
353
430
|
this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
|
|
@@ -387,13 +464,26 @@ export class BotFactory {
|
|
|
387
464
|
const additionalScopes = isStandardToken ? undefined : [
|
|
388
465
|
token.address
|
|
389
466
|
];
|
|
467
|
+
const mintBatch = new BatchCall(token.wallet, calls);
|
|
468
|
+
const { estimatedGas } = await mintBatch.simulate({
|
|
469
|
+
from: minter,
|
|
470
|
+
fee: {
|
|
471
|
+
estimateGas: true
|
|
472
|
+
},
|
|
473
|
+
additionalScopes
|
|
474
|
+
});
|
|
390
475
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
391
|
-
const { txHash } = await
|
|
476
|
+
const { txHash } = await mintBatch.send({
|
|
392
477
|
from: minter,
|
|
393
478
|
additionalScopes,
|
|
479
|
+
fee: {
|
|
480
|
+
gasSettings: estimatedGas
|
|
481
|
+
},
|
|
394
482
|
wait: NO_WAIT
|
|
395
483
|
});
|
|
396
|
-
this.log.info(`Sent token mint tx with hash ${txHash.toString()}
|
|
484
|
+
this.log.info(`Sent token mint tx with hash ${txHash.toString()}`, {
|
|
485
|
+
estimatedGas
|
|
486
|
+
});
|
|
397
487
|
return waitForTx(this.aztecNode, txHash, {
|
|
398
488
|
timeout: this.config.txMinedWaitSeconds
|
|
399
489
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/bot",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.3a4ae741b",
|
|
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": "0.0.1-commit.
|
|
58
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
59
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
60
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
61
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
62
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
63
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
64
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
65
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
66
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
67
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
68
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
69
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
70
|
-
"@aztec/wallets": "0.0.1-commit.
|
|
57
|
+
"@aztec/accounts": "0.0.1-commit.3a4ae741b",
|
|
58
|
+
"@aztec/aztec.js": "0.0.1-commit.3a4ae741b",
|
|
59
|
+
"@aztec/entrypoints": "0.0.1-commit.3a4ae741b",
|
|
60
|
+
"@aztec/ethereum": "0.0.1-commit.3a4ae741b",
|
|
61
|
+
"@aztec/foundation": "0.0.1-commit.3a4ae741b",
|
|
62
|
+
"@aztec/kv-store": "0.0.1-commit.3a4ae741b",
|
|
63
|
+
"@aztec/l1-artifacts": "0.0.1-commit.3a4ae741b",
|
|
64
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.3a4ae741b",
|
|
65
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.3a4ae741b",
|
|
66
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.3a4ae741b",
|
|
67
|
+
"@aztec/protocol-contracts": "0.0.1-commit.3a4ae741b",
|
|
68
|
+
"@aztec/stdlib": "0.0.1-commit.3a4ae741b",
|
|
69
|
+
"@aztec/telemetry-client": "0.0.1-commit.3a4ae741b",
|
|
70
|
+
"@aztec/wallets": "0.0.1-commit.3a4ae741b",
|
|
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/config.ts
CHANGED
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
secretStringConfigHelper,
|
|
12
12
|
} from '@aztec/foundation/config';
|
|
13
13
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
14
|
-
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
15
14
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
16
15
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
16
|
+
import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
17
17
|
import { schemas, zodFor } from '@aztec/stdlib/schemas';
|
|
18
18
|
import type { ComponentsVersions } from '@aztec/stdlib/versioning';
|
|
19
19
|
|
|
@@ -130,7 +130,6 @@ export const BotConfigSchema = zodFor<BotConfig>()(
|
|
|
130
130
|
l1Mnemonic: undefined,
|
|
131
131
|
l1PrivateKey: undefined,
|
|
132
132
|
senderPrivateKey: undefined,
|
|
133
|
-
dataDirectory: undefined,
|
|
134
133
|
dataStoreMapSizeKb: 1_024 * 1_024,
|
|
135
134
|
...config,
|
|
136
135
|
})),
|
package/src/factory.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
2
3
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
4
|
import {
|
|
4
5
|
BatchCall,
|
|
@@ -15,6 +16,7 @@ import { deriveKeys } from '@aztec/aztec.js/keys';
|
|
|
15
16
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
16
17
|
import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
|
|
17
18
|
import { waitForTx } from '@aztec/aztec.js/node';
|
|
19
|
+
import { ContractInitializationStatus } from '@aztec/aztec.js/wallet';
|
|
18
20
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
19
21
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
20
22
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
@@ -27,7 +29,7 @@ import { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
|
27
29
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
28
30
|
import { TestContract } from '@aztec/noir-test-contracts.js/Test';
|
|
29
31
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
30
|
-
import { GasSettings } from '@aztec/stdlib/gas';
|
|
32
|
+
import { GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
31
33
|
import type { AztecNode, AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
32
34
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
33
35
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
@@ -49,7 +51,11 @@ export class BotFactory {
|
|
|
49
51
|
private readonly store: BotStore,
|
|
50
52
|
private readonly aztecNode: AztecNode,
|
|
51
53
|
private readonly aztecNodeAdmin?: AztecNodeAdmin,
|
|
52
|
-
) {
|
|
54
|
+
) {
|
|
55
|
+
// Set fee padding on the wallet so that all transactions during setup
|
|
56
|
+
// (token deploy, minting, etc.) use the configured padding, not the default.
|
|
57
|
+
this.wallet.setMinFeePadding(config.minFeePadding);
|
|
58
|
+
}
|
|
53
59
|
|
|
54
60
|
/**
|
|
55
61
|
* Initializes a new bot by setting up the sender account, registering the recipient,
|
|
@@ -203,7 +209,7 @@ export class BotFactory {
|
|
|
203
209
|
const signingKey = deriveSigningKey(secret);
|
|
204
210
|
const accountManager = await this.wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
205
211
|
const metadata = await this.wallet.getContractMetadata(accountManager.address);
|
|
206
|
-
if (metadata.
|
|
212
|
+
if (metadata.initializationStatus === ContractInitializationStatus.INITIALIZED) {
|
|
207
213
|
this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
|
|
208
214
|
const timer = new Timer();
|
|
209
215
|
const address = accountManager.address;
|
|
@@ -219,15 +225,20 @@ export class BotFactory {
|
|
|
219
225
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
|
|
220
226
|
const deployMethod = await accountManager.getDeployMethod();
|
|
221
227
|
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
|
|
222
|
-
|
|
228
|
+
|
|
229
|
+
const { estimatedGas } = await deployMethod.simulate({
|
|
230
|
+
from: NO_FROM,
|
|
231
|
+
fee: { estimateGas: true, paymentMethod },
|
|
232
|
+
});
|
|
233
|
+
const gasSettings = GasSettings.from({ ...estimatedGas!, maxFeesPerGas, maxPriorityFeesPerGas: GasFees.empty() });
|
|
223
234
|
|
|
224
235
|
await this.withNoMinTxsPerBlock(async () => {
|
|
225
236
|
const { txHash } = await deployMethod.send({
|
|
226
|
-
from:
|
|
237
|
+
from: NO_FROM,
|
|
227
238
|
fee: { gasSettings, paymentMethod },
|
|
228
239
|
wait: NO_WAIT,
|
|
229
240
|
});
|
|
230
|
-
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}
|
|
241
|
+
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`, { gasSettings });
|
|
231
242
|
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
232
243
|
});
|
|
233
244
|
this.log.info(`Account deployed at ${address}`);
|
|
@@ -293,8 +304,9 @@ export class BotFactory {
|
|
|
293
304
|
await deploy.register();
|
|
294
305
|
} else {
|
|
295
306
|
this.log.info(`Deploying token contract at ${address.toString()}`);
|
|
296
|
-
const {
|
|
297
|
-
|
|
307
|
+
const { estimatedGas } = await deploy.simulate({ ...deployOpts, fee: { estimateGas: true } });
|
|
308
|
+
const { txHash } = await deploy.send({ ...deployOpts, fee: { gasSettings: estimatedGas }, wait: NO_WAIT });
|
|
309
|
+
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`, { estimatedGas });
|
|
298
310
|
await this.withNoMinTxsPerBlock(async () => {
|
|
299
311
|
await waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
300
312
|
return token;
|
|
@@ -334,10 +346,19 @@ export class BotFactory {
|
|
|
334
346
|
const amm = AMMContract.at(instance.address, this.wallet);
|
|
335
347
|
|
|
336
348
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
349
|
+
const setMinterInteraction = lpToken.methods.set_minter(amm.address, true);
|
|
350
|
+
const { estimatedGas: setMinterGas } = await setMinterInteraction.simulate({
|
|
351
|
+
from: deployer,
|
|
352
|
+
fee: { estimateGas: true },
|
|
353
|
+
});
|
|
354
|
+
const { receipt: minterReceipt } = await setMinterInteraction.send({
|
|
355
|
+
from: deployer,
|
|
356
|
+
fee: { gasSettings: setMinterGas },
|
|
357
|
+
wait: { timeout: this.config.txMinedWaitSeconds },
|
|
358
|
+
});
|
|
359
|
+
this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}`, {
|
|
360
|
+
estimatedGas: setMinterGas,
|
|
361
|
+
});
|
|
341
362
|
this.log.info(`Liquidity token initialized`);
|
|
342
363
|
|
|
343
364
|
return amm;
|
|
@@ -405,22 +426,44 @@ export class BotFactory {
|
|
|
405
426
|
.getFunctionCall(),
|
|
406
427
|
});
|
|
407
428
|
|
|
408
|
-
const
|
|
429
|
+
const mintBatch = new BatchCall(this.wallet, [
|
|
409
430
|
token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
410
431
|
token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
411
|
-
])
|
|
432
|
+
]);
|
|
433
|
+
const { estimatedGas: mintGas } = await mintBatch.simulate({
|
|
434
|
+
from: liquidityProvider,
|
|
435
|
+
fee: { estimateGas: true },
|
|
436
|
+
});
|
|
437
|
+
const { receipt: mintReceipt } = await mintBatch.send({
|
|
438
|
+
from: liquidityProvider,
|
|
439
|
+
fee: { gasSettings: mintGas },
|
|
440
|
+
wait: { timeout: this.config.txMinedWaitSeconds },
|
|
441
|
+
});
|
|
412
442
|
|
|
413
|
-
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}
|
|
443
|
+
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}`, { estimatedGas: mintGas });
|
|
414
444
|
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
445
|
+
const addLiquidityInteraction = amm.methods.add_liquidity(
|
|
446
|
+
amount0Max,
|
|
447
|
+
amount1Max,
|
|
448
|
+
amount0Min,
|
|
449
|
+
amount1Min,
|
|
450
|
+
authwitNonce,
|
|
451
|
+
);
|
|
452
|
+
const { estimatedGas: addLiquidityGas } = await addLiquidityInteraction.simulate({
|
|
453
|
+
from: liquidityProvider,
|
|
454
|
+
fee: { estimateGas: true },
|
|
455
|
+
authWitnesses: [token0Authwit, token1Authwit],
|
|
456
|
+
});
|
|
457
|
+
const { receipt: addLiquidityReceipt } = await addLiquidityInteraction.send({
|
|
458
|
+
from: liquidityProvider,
|
|
459
|
+
fee: { gasSettings: addLiquidityGas },
|
|
460
|
+
authWitnesses: [token0Authwit, token1Authwit],
|
|
461
|
+
wait: { timeout: this.config.txMinedWaitSeconds },
|
|
462
|
+
});
|
|
422
463
|
|
|
423
|
-
this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}
|
|
464
|
+
this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}`, {
|
|
465
|
+
estimatedGas: addLiquidityGas,
|
|
466
|
+
});
|
|
424
467
|
this.log.info(`Liquidity added`);
|
|
425
468
|
|
|
426
469
|
const [newT0Bal, newT1Bal, newLPBal] = await getPrivateBalances();
|
|
@@ -441,9 +484,10 @@ export class BotFactory {
|
|
|
441
484
|
this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
|
|
442
485
|
await deploy.register();
|
|
443
486
|
} else {
|
|
444
|
-
|
|
487
|
+
const { estimatedGas } = await deploy.simulate({ ...deployOpts, fee: { estimateGas: true } });
|
|
488
|
+
this.log.info(`Deploying contract ${name} at ${address.toString()}`, { estimatedGas });
|
|
445
489
|
await this.withNoMinTxsPerBlock(async () => {
|
|
446
|
-
const { txHash } = await deploy.send({ ...deployOpts, wait: NO_WAIT });
|
|
490
|
+
const { txHash } = await deploy.send({ ...deployOpts, fee: { gasSettings: estimatedGas }, wait: NO_WAIT });
|
|
447
491
|
this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
|
|
448
492
|
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
449
493
|
});
|
|
@@ -487,13 +531,16 @@ export class BotFactory {
|
|
|
487
531
|
|
|
488
532
|
// PrivateToken's mint accesses contract-level private storage vars (admin, total_supply).
|
|
489
533
|
const additionalScopes = isStandardToken ? undefined : [token.address];
|
|
534
|
+
const mintBatch = new BatchCall(token.wallet, calls);
|
|
535
|
+
const { estimatedGas } = await mintBatch.simulate({ from: minter, fee: { estimateGas: true }, additionalScopes });
|
|
490
536
|
await this.withNoMinTxsPerBlock(async () => {
|
|
491
|
-
const { txHash } = await
|
|
537
|
+
const { txHash } = await mintBatch.send({
|
|
492
538
|
from: minter,
|
|
493
539
|
additionalScopes,
|
|
540
|
+
fee: { gasSettings: estimatedGas },
|
|
494
541
|
wait: NO_WAIT,
|
|
495
542
|
});
|
|
496
|
-
this.log.info(`Sent token mint tx with hash ${txHash.toString()}
|
|
543
|
+
this.log.info(`Sent token mint tx with hash ${txHash.toString()}`, { estimatedGas });
|
|
497
544
|
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
498
545
|
});
|
|
499
546
|
}
|