@aztec/bot 0.0.1-commit.db765a8 → 0.0.1-commit.df81a97b5
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/cross_chain_bot.d.ts +1 -1
- package/dest/cross_chain_bot.d.ts.map +1 -1
- package/dest/cross_chain_bot.js +1 -8
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +108 -28
- package/package.json +15 -15
- package/src/config.ts +1 -2
- package/src/cross_chain_bot.ts +1 -8
- package/src/factory.ts +69 -33
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLGtCQUFrQixFQUN2QixXQUFXLEVBU1osTUFBTSwwQkFBMEIsQ0FBQztBQUNsQyxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFHcEQsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFzQixNQUFNLHdCQUF3QixDQUFDO0FBRWxGLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFFbkUsT0FBTyxFQUFFLENBQUMsRUFBRSxNQUFNLEtBQUssQ0FBQztBQUV4QixRQUFBLE1BQU0sY0FBYyx5REFBMEQsQ0FBQztBQUMvRSxLQUFLLGNBQWMsR0FBRyxDQUFDLE9BQU8sY0FBYyxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUM7QUFFdEQsUUFBQSxNQUFNLE9BQU8sNENBQTZDLENBQUM7QUFDM0QsS0FBSyxPQUFPLEdBQUcsQ0FBQyxPQUFPLE9BQU8sQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBRXhDLG9CQUFZ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7Ozs7Ozs7RUE4QzNCLENBQUM7QUFFRixlQUFPLE1BQU0saUJBQWlCLEVBQUUsa0JBQWtCLENBQUMsU0FBUyxDQW1LM0QsQ0FBQztBQUVGLHdCQUFnQixtQkFBbUIsSUFBSSxTQUFTLENBRS9DO0FBRUQsd0JBQWdCLG1CQUFtQixJQUFJLFNBQVMsQ0FFL0M7QUFFRCx3QkFBZ0IsV0FBVyxJQUFJLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUt6RCJ9
|
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,SA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AoB,EAAE,MAAM,CAAC;IAC7B,iDAAiD;IACjD,iBAAiB,EAAE,OAAO,CAAC;IAC3B,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;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
|
})));
|
|
@@ -51,4 +51,4 @@ export declare class CrossChainBot extends BaseBot {
|
|
|
51
51
|
private getReadyL1ToL2Message;
|
|
52
52
|
private seedNewL1ToL2Message;
|
|
53
53
|
}
|
|
54
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
54
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3Jvc3NfY2hhaW5fYm90LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY3Jvc3NfY2hhaW5fYm90LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0F3Qkc7QUFDSCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFHekQsT0FBTyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRSx3QkFBd0IsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXRFLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUN2RSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsY0FBYyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakYsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFOUQsT0FBTyxFQ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MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiD/D;IAED,UAAyB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBpF;YAGa,qBAAqB;YAoBrB,oBAAoB;CAUnC"}
|
package/dest/cross_chain_bot.js
CHANGED
|
@@ -116,14 +116,7 @@ import { seedL1ToL2Message } from './l1_to_l2_seeding.js';
|
|
|
116
116
|
/** Finds the oldest pending message that is ready for consumption. */ async getReadyL1ToL2Message(pendingMessages) {
|
|
117
117
|
const now = Date.now();
|
|
118
118
|
for (const msg of pendingMessages){
|
|
119
|
-
const ready = await isL1ToL2MessageReady(this.node, Fr.fromHexString(msg.msgHash)
|
|
120
|
-
// Use forPublicConsumption: false so we wait until blockNumber >= messageBlockNumber.
|
|
121
|
-
// With forPublicConsumption: true, the check returns true one block early (the sequencer
|
|
122
|
-
// includes L1→L2 messages before executing the block's txs), but gas estimation simulates
|
|
123
|
-
// against the current world state which doesn't yet have the message.
|
|
124
|
-
// See https://linear.app/aztec-labs/issue/A-548 for details.
|
|
125
|
-
forPublicConsumption: false
|
|
126
|
-
});
|
|
119
|
+
const ready = await isL1ToL2MessageReady(this.node, Fr.fromHexString(msg.msgHash));
|
|
127
120
|
if (ready) {
|
|
128
121
|
return msg;
|
|
129
122
|
}
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyx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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,MAAM,kBAAkB,CAAC;AAMjD,qBAAa,UAAU;IAInB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAPlC,OAAO,CAAC,GAAG,CAAuB;IAElC,YACmB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,SAAS,EACpB,cAAc,CAAC,4BAAgB,EAKjD;IAED;;;OAGG;IACU,KAAK,IAAI,OAAO,CAAC;QAC5B,MAAM,EAAE,cAAc,CAAC;QACvB,qBAAqB,EAAE,YAAY,CAAC;QACpC,KAAK,EAAE,aAAa,GAAG,oBAAoB,CAAC;QAC5C,IAAI,EAAE,SAAS,CAAC;QAChB,SAAS,EAAE,YAAY,CAAC;KACzB,CAAC,CAMD;IAEY,QAAQ,IAAI,OAAO,CAAC;QAC/B,MAAM,EAAE,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;YAejB,YAAY;YAWZ,0BAA0B;YA8C1B,gBAAgB;YAehB,UAAU;YAuDV,kBAAkB;YAalB,gBAAgB;YA+BhB,OAAO;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';
|
|
@@ -111,12 +112,7 @@ export class BotFactory {
|
|
|
111
112
|
this.log.info(`Waiting for first L1→L2 message to be ready...`);
|
|
112
113
|
const firstMsg = allMessages[0];
|
|
113
114
|
await waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(firstMsg.msgHash), {
|
|
114
|
-
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
115
|
-
// Use forPublicConsumption: false so we wait until the message is in the current world
|
|
116
|
-
// state. With true, it returns one block early which causes gas estimation simulation to
|
|
117
|
-
// fail since it runs against the current state.
|
|
118
|
-
// See https://linear.app/aztec-labs/issue/A-548 for details.
|
|
119
|
-
forPublicConsumption: false
|
|
115
|
+
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
120
116
|
});
|
|
121
117
|
this.log.info(`First L1→L2 message is ready`);
|
|
122
118
|
}
|
|
@@ -157,7 +153,7 @@ export class BotFactory {
|
|
|
157
153
|
const signingKey = deriveSigningKey(secret);
|
|
158
154
|
const accountManager = await this.wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
159
155
|
const metadata = await this.wallet.getContractMetadata(accountManager.address);
|
|
160
|
-
if (metadata.
|
|
156
|
+
if (metadata.initializationStatus === ContractInitializationStatus.INITIALIZED) {
|
|
161
157
|
this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
|
|
162
158
|
const timer = new Timer();
|
|
163
159
|
const address = accountManager.address;
|
|
@@ -171,19 +167,30 @@ export class BotFactory {
|
|
|
171
167
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
|
|
172
168
|
const deployMethod = await accountManager.getDeployMethod();
|
|
173
169
|
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
|
|
174
|
-
const
|
|
175
|
-
|
|
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()
|
|
176
181
|
});
|
|
177
182
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
178
183
|
const { txHash } = await deployMethod.send({
|
|
179
|
-
from:
|
|
184
|
+
from: NO_FROM,
|
|
180
185
|
fee: {
|
|
181
186
|
gasSettings,
|
|
182
187
|
paymentMethod
|
|
183
188
|
},
|
|
184
189
|
wait: NO_WAIT
|
|
185
190
|
});
|
|
186
|
-
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
|
+
});
|
|
187
194
|
return waitForTx(this.aztecNode, txHash, {
|
|
188
195
|
timeout: this.config.txMinedWaitSeconds
|
|
189
196
|
});
|
|
@@ -242,11 +249,22 @@ export class BotFactory {
|
|
|
242
249
|
await deploy.register();
|
|
243
250
|
} else {
|
|
244
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
|
+
});
|
|
245
258
|
const { txHash } = await deploy.send({
|
|
246
259
|
...deployOpts,
|
|
260
|
+
fee: {
|
|
261
|
+
gasSettings: estimatedGas
|
|
262
|
+
},
|
|
247
263
|
wait: NO_WAIT
|
|
248
264
|
});
|
|
249
|
-
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
|
+
});
|
|
250
268
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
251
269
|
await waitForTx(this.aztecNode, txHash, {
|
|
252
270
|
timeout: this.config.txMinedWaitSeconds
|
|
@@ -280,13 +298,25 @@ export class BotFactory {
|
|
|
280
298
|
const instance = await this.registerOrDeployContract('AMM', deploy, deployOpts);
|
|
281
299
|
const amm = AMMContract.at(instance.address, this.wallet);
|
|
282
300
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
283
|
-
const
|
|
301
|
+
const setMinterInteraction = lpToken.methods.set_minter(amm.address, true);
|
|
302
|
+
const { estimatedGas: setMinterGas } = await setMinterInteraction.simulate({
|
|
284
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
|
+
},
|
|
285
313
|
wait: {
|
|
286
314
|
timeout: this.config.txMinedWaitSeconds
|
|
287
315
|
}
|
|
288
316
|
});
|
|
289
|
-
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
|
+
});
|
|
290
320
|
this.log.info(`Liquidity token initialized`);
|
|
291
321
|
return amm;
|
|
292
322
|
}
|
|
@@ -319,18 +349,44 @@ export class BotFactory {
|
|
|
319
349
|
caller: amm.address,
|
|
320
350
|
call: await token1.methods.transfer_to_public_and_prepare_private_balance_increase(liquidityProvider, amm.address, amount1Max, authwitNonce).getFunctionCall()
|
|
321
351
|
});
|
|
322
|
-
const
|
|
352
|
+
const mintBatch = new BatchCall(this.wallet, [
|
|
323
353
|
token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
324
354
|
token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE)
|
|
325
|
-
])
|
|
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({
|
|
326
363
|
from: liquidityProvider,
|
|
364
|
+
fee: {
|
|
365
|
+
gasSettings: mintGas
|
|
366
|
+
},
|
|
327
367
|
wait: {
|
|
328
368
|
timeout: this.config.txMinedWaitSeconds
|
|
329
369
|
}
|
|
330
370
|
});
|
|
331
|
-
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}
|
|
332
|
-
|
|
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({
|
|
333
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
|
+
},
|
|
334
390
|
authWitnesses: [
|
|
335
391
|
token0Authwit,
|
|
336
392
|
token1Authwit
|
|
@@ -339,7 +395,9 @@ export class BotFactory {
|
|
|
339
395
|
timeout: this.config.txMinedWaitSeconds
|
|
340
396
|
}
|
|
341
397
|
});
|
|
342
|
-
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
|
+
});
|
|
343
401
|
this.log.info(`Liquidity added`);
|
|
344
402
|
const [newT0Bal, newT1Bal, newLPBal] = await getPrivateBalances();
|
|
345
403
|
this.log.info(`Updated private balances of ${defaultAccountAddress} after minting and funding AMM: token0=${newT0Bal}, token1=${newT1Bal}, lp=${newLPBal}`);
|
|
@@ -352,10 +410,21 @@ export class BotFactory {
|
|
|
352
410
|
this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
|
|
353
411
|
await deploy.register();
|
|
354
412
|
} else {
|
|
355
|
-
|
|
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
|
+
});
|
|
356
422
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
357
423
|
const { txHash } = await deploy.send({
|
|
358
424
|
...deployOpts,
|
|
425
|
+
fee: {
|
|
426
|
+
gasSettings: estimatedGas
|
|
427
|
+
},
|
|
359
428
|
wait: NO_WAIT
|
|
360
429
|
});
|
|
361
430
|
this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
|
|
@@ -395,13 +464,26 @@ export class BotFactory {
|
|
|
395
464
|
const additionalScopes = isStandardToken ? undefined : [
|
|
396
465
|
token.address
|
|
397
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
|
+
});
|
|
398
475
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
399
|
-
const { txHash } = await
|
|
476
|
+
const { txHash } = await mintBatch.send({
|
|
400
477
|
from: minter,
|
|
401
478
|
additionalScopes,
|
|
479
|
+
fee: {
|
|
480
|
+
gasSettings: estimatedGas
|
|
481
|
+
},
|
|
402
482
|
wait: NO_WAIT
|
|
403
483
|
});
|
|
404
|
-
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
|
+
});
|
|
405
487
|
return waitForTx(this.aztecNode, txHash, {
|
|
406
488
|
timeout: this.config.txMinedWaitSeconds
|
|
407
489
|
});
|
|
@@ -420,8 +502,7 @@ export class BotFactory {
|
|
|
420
502
|
try {
|
|
421
503
|
const messageHash = Fr.fromHexString(existingClaim.claim.messageHash);
|
|
422
504
|
await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.aztecNode, messageHash, {
|
|
423
|
-
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
424
|
-
forPublicConsumption: false
|
|
505
|
+
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
425
506
|
}));
|
|
426
507
|
return existingClaim.claim;
|
|
427
508
|
} catch (err) {
|
|
@@ -449,8 +530,7 @@ export class BotFactory {
|
|
|
449
530
|
const mintAmount = await portal.getTokenManager().getMintAmount();
|
|
450
531
|
const claim = await portal.bridgeTokensPublic(recipient, mintAmount, true);
|
|
451
532
|
await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(claim.messageHash), {
|
|
452
|
-
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
453
|
-
forPublicConsumption: false
|
|
533
|
+
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
454
534
|
}));
|
|
455
535
|
this.log.info(`Created a claim for ${mintAmount} L1 fee juice to ${recipient}.`, claim);
|
|
456
536
|
return claim;
|
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.df81a97b5",
|
|
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.df81a97b5",
|
|
58
|
+
"@aztec/aztec.js": "0.0.1-commit.df81a97b5",
|
|
59
|
+
"@aztec/entrypoints": "0.0.1-commit.df81a97b5",
|
|
60
|
+
"@aztec/ethereum": "0.0.1-commit.df81a97b5",
|
|
61
|
+
"@aztec/foundation": "0.0.1-commit.df81a97b5",
|
|
62
|
+
"@aztec/kv-store": "0.0.1-commit.df81a97b5",
|
|
63
|
+
"@aztec/l1-artifacts": "0.0.1-commit.df81a97b5",
|
|
64
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.df81a97b5",
|
|
65
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.df81a97b5",
|
|
66
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.df81a97b5",
|
|
67
|
+
"@aztec/protocol-contracts": "0.0.1-commit.df81a97b5",
|
|
68
|
+
"@aztec/stdlib": "0.0.1-commit.df81a97b5",
|
|
69
|
+
"@aztec/telemetry-client": "0.0.1-commit.df81a97b5",
|
|
70
|
+
"@aztec/wallets": "0.0.1-commit.df81a97b5",
|
|
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/cross_chain_bot.ts
CHANGED
|
@@ -175,14 +175,7 @@ export class CrossChainBot extends BaseBot {
|
|
|
175
175
|
): Promise<PendingL1ToL2Message | undefined> {
|
|
176
176
|
const now = Date.now();
|
|
177
177
|
for (const msg of pendingMessages) {
|
|
178
|
-
const ready = await isL1ToL2MessageReady(this.node, Fr.fromHexString(msg.msgHash)
|
|
179
|
-
// Use forPublicConsumption: false so we wait until blockNumber >= messageBlockNumber.
|
|
180
|
-
// With forPublicConsumption: true, the check returns true one block early (the sequencer
|
|
181
|
-
// includes L1→L2 messages before executing the block's txs), but gas estimation simulates
|
|
182
|
-
// against the current world state which doesn't yet have the message.
|
|
183
|
-
// See https://linear.app/aztec-labs/issue/A-548 for details.
|
|
184
|
-
forPublicConsumption: false,
|
|
185
|
-
});
|
|
178
|
+
const ready = await isL1ToL2MessageReady(this.node, Fr.fromHexString(msg.msgHash));
|
|
186
179
|
if (ready) {
|
|
187
180
|
return msg;
|
|
188
181
|
}
|
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';
|
|
@@ -162,11 +164,6 @@ export class BotFactory {
|
|
|
162
164
|
const firstMsg = allMessages[0];
|
|
163
165
|
await waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(firstMsg.msgHash), {
|
|
164
166
|
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
|
|
165
|
-
// Use forPublicConsumption: false so we wait until the message is in the current world
|
|
166
|
-
// state. With true, it returns one block early which causes gas estimation simulation to
|
|
167
|
-
// fail since it runs against the current state.
|
|
168
|
-
// See https://linear.app/aztec-labs/issue/A-548 for details.
|
|
169
|
-
forPublicConsumption: false,
|
|
170
167
|
});
|
|
171
168
|
this.log.info(`First L1→L2 message is ready`);
|
|
172
169
|
}
|
|
@@ -212,7 +209,7 @@ export class BotFactory {
|
|
|
212
209
|
const signingKey = deriveSigningKey(secret);
|
|
213
210
|
const accountManager = await this.wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
214
211
|
const metadata = await this.wallet.getContractMetadata(accountManager.address);
|
|
215
|
-
if (metadata.
|
|
212
|
+
if (metadata.initializationStatus === ContractInitializationStatus.INITIALIZED) {
|
|
216
213
|
this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
|
|
217
214
|
const timer = new Timer();
|
|
218
215
|
const address = accountManager.address;
|
|
@@ -228,15 +225,20 @@ export class BotFactory {
|
|
|
228
225
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
|
|
229
226
|
const deployMethod = await accountManager.getDeployMethod();
|
|
230
227
|
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
|
|
231
|
-
|
|
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() });
|
|
232
234
|
|
|
233
235
|
await this.withNoMinTxsPerBlock(async () => {
|
|
234
236
|
const { txHash } = await deployMethod.send({
|
|
235
|
-
from:
|
|
237
|
+
from: NO_FROM,
|
|
236
238
|
fee: { gasSettings, paymentMethod },
|
|
237
239
|
wait: NO_WAIT,
|
|
238
240
|
});
|
|
239
|
-
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 });
|
|
240
242
|
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
241
243
|
});
|
|
242
244
|
this.log.info(`Account deployed at ${address}`);
|
|
@@ -302,8 +304,9 @@ export class BotFactory {
|
|
|
302
304
|
await deploy.register();
|
|
303
305
|
} else {
|
|
304
306
|
this.log.info(`Deploying token contract at ${address.toString()}`);
|
|
305
|
-
const {
|
|
306
|
-
|
|
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 });
|
|
307
310
|
await this.withNoMinTxsPerBlock(async () => {
|
|
308
311
|
await waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
309
312
|
return token;
|
|
@@ -343,10 +346,19 @@ export class BotFactory {
|
|
|
343
346
|
const amm = AMMContract.at(instance.address, this.wallet);
|
|
344
347
|
|
|
345
348
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
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
|
+
});
|
|
350
362
|
this.log.info(`Liquidity token initialized`);
|
|
351
363
|
|
|
352
364
|
return amm;
|
|
@@ -414,22 +426,44 @@ export class BotFactory {
|
|
|
414
426
|
.getFunctionCall(),
|
|
415
427
|
});
|
|
416
428
|
|
|
417
|
-
const
|
|
429
|
+
const mintBatch = new BatchCall(this.wallet, [
|
|
418
430
|
token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
419
431
|
token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
420
|
-
])
|
|
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
|
+
});
|
|
421
442
|
|
|
422
|
-
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}
|
|
443
|
+
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}`, { estimatedGas: mintGas });
|
|
423
444
|
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
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
|
+
});
|
|
431
463
|
|
|
432
|
-
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
|
+
});
|
|
433
467
|
this.log.info(`Liquidity added`);
|
|
434
468
|
|
|
435
469
|
const [newT0Bal, newT1Bal, newLPBal] = await getPrivateBalances();
|
|
@@ -450,9 +484,10 @@ export class BotFactory {
|
|
|
450
484
|
this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
|
|
451
485
|
await deploy.register();
|
|
452
486
|
} else {
|
|
453
|
-
|
|
487
|
+
const { estimatedGas } = await deploy.simulate({ ...deployOpts, fee: { estimateGas: true } });
|
|
488
|
+
this.log.info(`Deploying contract ${name} at ${address.toString()}`, { estimatedGas });
|
|
454
489
|
await this.withNoMinTxsPerBlock(async () => {
|
|
455
|
-
const { txHash } = await deploy.send({ ...deployOpts, wait: NO_WAIT });
|
|
490
|
+
const { txHash } = await deploy.send({ ...deployOpts, fee: { gasSettings: estimatedGas }, wait: NO_WAIT });
|
|
456
491
|
this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
|
|
457
492
|
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
458
493
|
});
|
|
@@ -496,13 +531,16 @@ export class BotFactory {
|
|
|
496
531
|
|
|
497
532
|
// PrivateToken's mint accesses contract-level private storage vars (admin, total_supply).
|
|
498
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 });
|
|
499
536
|
await this.withNoMinTxsPerBlock(async () => {
|
|
500
|
-
const { txHash } = await
|
|
537
|
+
const { txHash } = await mintBatch.send({
|
|
501
538
|
from: minter,
|
|
502
539
|
additionalScopes,
|
|
540
|
+
fee: { gasSettings: estimatedGas },
|
|
503
541
|
wait: NO_WAIT,
|
|
504
542
|
});
|
|
505
|
-
this.log.info(`Sent token mint tx with hash ${txHash.toString()}
|
|
543
|
+
this.log.info(`Sent token mint tx with hash ${txHash.toString()}`, { estimatedGas });
|
|
506
544
|
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
507
545
|
});
|
|
508
546
|
}
|
|
@@ -524,7 +562,6 @@ export class BotFactory {
|
|
|
524
562
|
await this.withNoMinTxsPerBlock(() =>
|
|
525
563
|
waitForL1ToL2MessageReady(this.aztecNode, messageHash, {
|
|
526
564
|
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
|
|
527
|
-
forPublicConsumption: false,
|
|
528
565
|
}),
|
|
529
566
|
);
|
|
530
567
|
return existingClaim.claim;
|
|
@@ -563,7 +600,6 @@ export class BotFactory {
|
|
|
563
600
|
await this.withNoMinTxsPerBlock(() =>
|
|
564
601
|
waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(claim.messageHash), {
|
|
565
602
|
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
|
|
566
|
-
forPublicConsumption: false,
|
|
567
603
|
}),
|
|
568
604
|
);
|
|
569
605
|
|