@aztec/bot 0.0.1-commit.88e6f9396 → 0.0.1-commit.8c0b8ff
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/amm_bot.js +1 -1
- package/dest/base_bot.d.ts +3 -3
- package/dest/base_bot.d.ts.map +1 -1
- package/dest/base_bot.js +12 -22
- package/dest/bot.d.ts +1 -1
- package/dest/bot.d.ts.map +1 -1
- package/dest/bot.js +1 -5
- package/dest/config.d.ts +5 -5
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +4 -3
- package/dest/cross_chain_bot.js +1 -1
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +16 -107
- package/package.json +15 -15
- package/src/amm_bot.ts +1 -1
- package/src/base_bot.ts +8 -16
- package/src/bot.ts +1 -4
- package/src/config.ts +6 -5
- package/src/cross_chain_bot.ts +1 -1
- package/src/factory.ts +27 -69
package/dest/amm_bot.js
CHANGED
|
@@ -52,7 +52,7 @@ export class AmmBot extends BaseBot {
|
|
|
52
52
|
swapAuthwit
|
|
53
53
|
]
|
|
54
54
|
});
|
|
55
|
-
const opts =
|
|
55
|
+
const opts = this.getSendMethodOpts();
|
|
56
56
|
this.log.verbose(`Sending transaction`, logCtx);
|
|
57
57
|
this.log.info(`Tx. Balances: ${jsonStringify(balances)}`, {
|
|
58
58
|
...logCtx,
|
package/dest/base_bot.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import {
|
|
2
|
+
import type { SendInteractionOptions } from '@aztec/aztec.js/contracts';
|
|
3
3
|
import { TxHash, TxReceipt } from '@aztec/aztec.js/tx';
|
|
4
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import type { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
@@ -16,6 +16,6 @@ export declare abstract class BaseBot {
|
|
|
16
16
|
run(): Promise<TxReceipt | TxHash>;
|
|
17
17
|
protected abstract createAndSendTx(logCtx: object): Promise<TxHash>;
|
|
18
18
|
protected onTxMined(_receipt: TxReceipt, _logCtx: object): Promise<void>;
|
|
19
|
-
protected getSendMethodOpts(
|
|
19
|
+
protected getSendMethodOpts(): SendInteractionOptions;
|
|
20
20
|
}
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV9ib3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9iYXNlX2JvdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUd4RSxPQUFPLEVBQUUsTUFBTSxFQUFFLFNBQVMsRUFBWSxNQUFNLG9CQUFvQixDQUFDO0FBRWpFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRTlELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUU3Qyw4QkFBc0IsT0FBTzthQU9ULElBQUksRUFBRSxTQUFTO2FBQ2YsTUFBTSxFQUFFLGNBQWM7YUFDdEIscUJBQXFCLEVBQUUsWUFBWTtJQUM1QyxNQUFNLEVBQUUsU0FBUztJQVQxQixTQUFTLENBQUMsR0FBRyx1Q0FBdUI7SUFFcEMsU0FBUyxDQUFDLFFBQVEsRUFBRSxNQUFNLENBQUs7SUFDL0IsU0FBUyxDQUFDLFNBQVMsRUFBRSxNQUFNLENBQUs7SUFFaEMsU0FBUyxhQUNTLElBQUksRUFBRSxTQUFTLEVBQ2YsTUFBTSxFQUFFLGNBQWMsRUFDdEIscUJBQXFCLEVBQUUsWUFBWSxFQUM1QyxNQUFNLEVBQUUsU0FBUyxFQUN0QjtJQUVTLEdBQUcsSUFBSSxPQUFPLENBQUMsU0FBUyxHQUFHLE1BQU0sQ0FBQyxDQXlCOUM7SUFFRCxTQUFTLENBQUMsUUFBUSxDQUFDLGVBQWUsQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUVwRSxTQUFTLENBQUMsU0FBUyxDQUFDLFFBQVEsRUFBRSxTQUFTLEVBQUUsT0FBTyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBR3ZFO0lBRUQsU0FBUyxDQUFDLGlCQUFpQixJQUFJLHNCQUFzQixDQWNwRDtDQUNGIn0=
|
package/dest/base_bot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base_bot.d.ts","sourceRoot":"","sources":["../src/base_bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"base_bot.d.ts","sourceRoot":"","sources":["../src/base_bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGxE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAY,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,8BAAsB,OAAO;aAOT,IAAI,EAAE,SAAS;aACf,MAAM,EAAE,cAAc;aACtB,qBAAqB,EAAE,YAAY;IAC5C,MAAM,EAAE,SAAS;IAT1B,SAAS,CAAC,GAAG,uCAAuB;IAEpC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAK;IAC/B,SAAS,CAAC,SAAS,EAAE,MAAM,CAAK;IAEhC,SAAS,aACS,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,cAAc,EACtB,qBAAqB,EAAE,YAAY,EAC5C,MAAM,EAAE,SAAS,EACtB;IAES,GAAG,IAAI,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,CAyB9C;IAED,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpE,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE;IAED,SAAS,CAAC,iBAAiB,IAAI,sBAAsB,CAcpD;CACF"}
|
package/dest/base_bot.js
CHANGED
|
@@ -48,32 +48,22 @@ export class BaseBot {
|
|
|
48
48
|
// no-op
|
|
49
49
|
return Promise.resolve();
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
getSendMethodOpts() {
|
|
52
52
|
const { l2GasLimit, daGasLimit, minFeePadding } = this.config;
|
|
53
53
|
this.wallet.setMinFeePadding(minFeePadding);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
};
|
|
62
|
-
this.log.verbose(`Using gas limits ${l2GasLimit} L2 gas ${daGasLimit} DA gas`);
|
|
63
|
-
} else {
|
|
64
|
-
this.log.verbose(`Estimating gas for transaction`);
|
|
65
|
-
({ estimatedGas: gasSettings } = await interaction.simulate({
|
|
66
|
-
fee: {
|
|
67
|
-
estimateGas: true
|
|
68
|
-
},
|
|
69
|
-
from: this.defaultAccountAddress
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
54
|
+
const gasSettings = l2GasLimit !== undefined && l2GasLimit > 0 && daGasLimit !== undefined && daGasLimit > 0 ? {
|
|
55
|
+
gasLimits: Gas.from({
|
|
56
|
+
l2Gas: l2GasLimit,
|
|
57
|
+
daGas: daGasLimit
|
|
58
|
+
})
|
|
59
|
+
} : undefined;
|
|
72
60
|
return {
|
|
73
61
|
from: this.defaultAccountAddress,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
...gasSettings ? {
|
|
63
|
+
fee: {
|
|
64
|
+
gasSettings
|
|
65
|
+
}
|
|
66
|
+
} : {}
|
|
77
67
|
};
|
|
78
68
|
}
|
|
79
69
|
}
|
package/dest/bot.d.ts
CHANGED
|
@@ -25,4 +25,4 @@ export declare class Bot extends BaseBot {
|
|
|
25
25
|
};
|
|
26
26
|
}>;
|
|
27
27
|
}
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm90LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYm90LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBRTlELE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUU1QyxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHVDQUF1QyxDQUFDO0FBQ2xGLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRixPQUFPLEtBQUssRUFBRSxjQUFj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fer_in_public(this.defaultAccountAddress, recipient, TRANSFER_AMOUNT, 0))
|
|
31
31
|
].flat() : times(privateTransfersPerTx, ()=>token.methods.transfer(TRANSFER_AMOUNT, this.defaultAccountAddress, recipient));
|
|
32
32
|
const batch = new BatchCall(wallet, calls);
|
|
33
|
-
const opts =
|
|
34
|
-
this.log.verbose(`Simulating transaction with ${calls.length}`, logCtx);
|
|
35
|
-
await batch.simulate({
|
|
36
|
-
from: this.defaultAccountAddress
|
|
37
|
-
});
|
|
33
|
+
const opts = this.getSendMethodOpts();
|
|
38
34
|
this.log.verbose(`Sending transaction`, logCtx);
|
|
39
35
|
const { txHash } = await batch.send({
|
|
40
36
|
...opts,
|
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/
|
|
3
|
+
import { type DataStoreConfig } from '@aztec/kv-store/config';
|
|
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"];
|
|
@@ -50,9 +50,9 @@ export type BotConfig = {
|
|
|
50
50
|
maxPendingTxs: number;
|
|
51
51
|
/** Whether to flush after sending each 'setup' transaction */
|
|
52
52
|
flushSetupTransactions: boolean;
|
|
53
|
-
/** L2 gas limit for the tx (empty to
|
|
53
|
+
/** L2 gas limit for the tx (empty to let the bot's wallet estimate). */
|
|
54
54
|
l2GasLimit: number | undefined;
|
|
55
|
-
/** DA gas limit for the tx (empty to
|
|
55
|
+
/** DA gas limit for the tx (empty to let the bot's wallet estimate). */
|
|
56
56
|
daGasLimit: number | undefined;
|
|
57
57
|
/** Token contract to use */
|
|
58
58
|
contract: SupportedTokenContracts;
|
|
@@ -176,7 +176,6 @@ 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;
|
|
180
179
|
nodeUrl: string | undefined;
|
|
181
180
|
nodeAdminUrl: string | undefined;
|
|
182
181
|
l1RpcUrls: string[] | undefined;
|
|
@@ -186,6 +185,7 @@ export declare const BotConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
186
185
|
l1Mnemonic: SecretValue<string> | undefined;
|
|
187
186
|
l1PrivateKey: SecretValue<string> | undefined;
|
|
188
187
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLGtCQUFrQixFQUN2QixXQUFXLEVBU1osTUFBTSwwQkFBMEIsQ0FBQztBQUNsQyxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFzQixNQUFNLHdCQUF3QixDQUFDO0FBSWxGLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU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ConfigMappings, secretFrConfigHelper, secretStringConfigHelper } from '@aztec/foundation/config';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
3
4
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
5
|
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,6 +61,7 @@ export const BotConfigSchema = zodFor()(z.object({
|
|
|
61
61
|
l1Mnemonic: undefined,
|
|
62
62
|
l1PrivateKey: undefined,
|
|
63
63
|
senderPrivateKey: undefined,
|
|
64
|
+
dataDirectory: undefined,
|
|
64
65
|
dataStoreMapSizeKb: 1_024 * 1_024,
|
|
65
66
|
...config
|
|
66
67
|
})));
|
|
@@ -172,12 +173,12 @@ export const botConfigMappings = {
|
|
|
172
173
|
},
|
|
173
174
|
l2GasLimit: {
|
|
174
175
|
env: 'BOT_L2_GAS_LIMIT',
|
|
175
|
-
description:
|
|
176
|
+
description: "L2 gas limit for the tx (empty to let the bot's wallet estimate).",
|
|
176
177
|
...optionalNumberConfigHelper()
|
|
177
178
|
},
|
|
178
179
|
daGasLimit: {
|
|
179
180
|
env: 'BOT_DA_GAS_LIMIT',
|
|
180
|
-
description:
|
|
181
|
+
description: "DA gas limit for the tx (empty to let the bot's wallet estimate).",
|
|
181
182
|
...optionalNumberConfigHelper()
|
|
182
183
|
},
|
|
183
184
|
contract: {
|
package/dest/cross_chain_bot.js
CHANGED
|
@@ -82,7 +82,7 @@ import { seedL1ToL2Message } from './l1_to_l2_seeding.js';
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
const batch = new BatchCall(this.wallet, calls);
|
|
85
|
-
const opts =
|
|
85
|
+
const opts = this.getSendMethodOpts();
|
|
86
86
|
this.log.verbose(`Sending cross-chain batch with ${calls.length} calls`, logCtx);
|
|
87
87
|
const { txHash } = await batch.send({
|
|
88
88
|
...opts,
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBb0J6RCxPQUFPLEtBQUssRUFBRSx3QkFBd0IsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBSXRFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUMzRCxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSx1Q0FBdUMsQ0FBQztBQUM3RSxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDL0QsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBRWxFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRixPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFekQsT0FBTyxFQUFFLEtBQUssU0FBUyxFQUEyQixNQUFNLGFBQWEsQ0FBQztBQUV0RSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQU1qR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3ZCLHFCQUFxQixFQUFFLFlBQVksQ0FBQztRQUNwQyxRQUFRLEVBQUUsWUFBWSxDQUFDO1FBQ3ZCLElBQUksRUFBRSxTQUFTLENBQUM7UUFDaEIsUUFBUSxFQUFFLHdCQUF3QixDQUFDO1FBQ25DLGFBQWEsRUFBRSxNQUFNLENBQUM7S0FDdkIsQ0FBQyxDQTJERDtZQUVhLGlCQUFpQjtZQWVqQixZQUFZO1lBV1osMEJBQTBCO1lBdUMxQixnQkFBZ0I7WUFlaEIsVUFBVTtZQXNEVixrQkFBa0I7WUFhbEIsZ0JBQWdCO1lBc0JoQixPQUFPO1lBc0ZQLHdCQUF3QjtZQTBCeEIsVUFBVTtZQWdEVixzQkFBc0I7WUEyQnRCLGdCQUFnQjtZQStCaEIsb0JBQW9CO0NBZW5DIn0=
|
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;AAElE,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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,OAAO;YAsFP,wBAAwB;YA0BxB,UAAU;YAgDV,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,6 @@ 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 { GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
21
21
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
22
22
|
import { SupportedTokenContracts } from './config.js';
|
|
23
23
|
import { seedL1ToL2Message } from './l1_to_l2_seeding.js';
|
|
@@ -152,7 +152,7 @@ export class BotFactory {
|
|
|
152
152
|
const signingKey = deriveSigningKey(secret);
|
|
153
153
|
const accountManager = await this.wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
154
154
|
const metadata = await this.wallet.getContractMetadata(accountManager.address);
|
|
155
|
-
if (metadata.
|
|
155
|
+
if (metadata.initializationStatus === ContractInitializationStatus.INITIALIZED) {
|
|
156
156
|
this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
|
|
157
157
|
const timer = new Timer();
|
|
158
158
|
const address = accountManager.address;
|
|
@@ -165,31 +165,15 @@ export class BotFactory {
|
|
|
165
165
|
const claim = await this.getOrCreateBridgeClaim(address);
|
|
166
166
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
|
|
167
167
|
const deployMethod = await accountManager.getDeployMethod();
|
|
168
|
-
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
|
|
169
|
-
const { estimatedGas } = await deployMethod.simulate({
|
|
170
|
-
from: AztecAddress.ZERO,
|
|
171
|
-
fee: {
|
|
172
|
-
estimateGas: true,
|
|
173
|
-
paymentMethod
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
const gasSettings = GasSettings.from({
|
|
177
|
-
...estimatedGas,
|
|
178
|
-
maxFeesPerGas,
|
|
179
|
-
maxPriorityFeesPerGas: GasFees.empty()
|
|
180
|
-
});
|
|
181
168
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
182
169
|
const { txHash } = await deployMethod.send({
|
|
183
|
-
from:
|
|
170
|
+
from: NO_FROM,
|
|
184
171
|
fee: {
|
|
185
|
-
gasSettings,
|
|
186
172
|
paymentMethod
|
|
187
173
|
},
|
|
188
174
|
wait: NO_WAIT
|
|
189
175
|
});
|
|
190
|
-
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}
|
|
191
|
-
gasSettings
|
|
192
|
-
});
|
|
176
|
+
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`);
|
|
193
177
|
return waitForTx(this.aztecNode, txHash, {
|
|
194
178
|
timeout: this.config.txMinedWaitSeconds
|
|
195
179
|
});
|
|
@@ -248,22 +232,11 @@ export class BotFactory {
|
|
|
248
232
|
await deploy.register();
|
|
249
233
|
} else {
|
|
250
234
|
this.log.info(`Deploying token contract at ${address.toString()}`);
|
|
251
|
-
const { estimatedGas } = await deploy.simulate({
|
|
252
|
-
...deployOpts,
|
|
253
|
-
fee: {
|
|
254
|
-
estimateGas: true
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
235
|
const { txHash } = await deploy.send({
|
|
258
236
|
...deployOpts,
|
|
259
|
-
fee: {
|
|
260
|
-
gasSettings: estimatedGas
|
|
261
|
-
},
|
|
262
237
|
wait: NO_WAIT
|
|
263
238
|
});
|
|
264
|
-
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}
|
|
265
|
-
estimatedGas
|
|
266
|
-
});
|
|
239
|
+
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`);
|
|
267
240
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
268
241
|
await waitForTx(this.aztecNode, txHash, {
|
|
269
242
|
timeout: this.config.txMinedWaitSeconds
|
|
@@ -297,25 +270,13 @@ export class BotFactory {
|
|
|
297
270
|
const instance = await this.registerOrDeployContract('AMM', deploy, deployOpts);
|
|
298
271
|
const amm = AMMContract.at(instance.address, this.wallet);
|
|
299
272
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
300
|
-
const
|
|
301
|
-
const { estimatedGas: setMinterGas } = await setMinterInteraction.simulate({
|
|
302
|
-
from: deployer,
|
|
303
|
-
fee: {
|
|
304
|
-
estimateGas: true
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
const { receipt: minterReceipt } = await setMinterInteraction.send({
|
|
273
|
+
const { receipt: minterReceipt } = await lpToken.methods.set_minter(amm.address, true).send({
|
|
308
274
|
from: deployer,
|
|
309
|
-
fee: {
|
|
310
|
-
gasSettings: setMinterGas
|
|
311
|
-
},
|
|
312
275
|
wait: {
|
|
313
276
|
timeout: this.config.txMinedWaitSeconds
|
|
314
277
|
}
|
|
315
278
|
});
|
|
316
|
-
this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}
|
|
317
|
-
estimatedGas: setMinterGas
|
|
318
|
-
});
|
|
279
|
+
this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}`);
|
|
319
280
|
this.log.info(`Liquidity token initialized`);
|
|
320
281
|
return amm;
|
|
321
282
|
}
|
|
@@ -348,44 +309,18 @@ export class BotFactory {
|
|
|
348
309
|
caller: amm.address,
|
|
349
310
|
call: await token1.methods.transfer_to_public_and_prepare_private_balance_increase(liquidityProvider, amm.address, amount1Max, authwitNonce).getFunctionCall()
|
|
350
311
|
});
|
|
351
|
-
const
|
|
312
|
+
const { receipt: mintReceipt } = await new BatchCall(this.wallet, [
|
|
352
313
|
token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
353
314
|
token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE)
|
|
354
|
-
])
|
|
355
|
-
const { estimatedGas: mintGas } = await mintBatch.simulate({
|
|
315
|
+
]).send({
|
|
356
316
|
from: liquidityProvider,
|
|
357
|
-
fee: {
|
|
358
|
-
estimateGas: true
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
const { receipt: mintReceipt } = await mintBatch.send({
|
|
362
|
-
from: liquidityProvider,
|
|
363
|
-
fee: {
|
|
364
|
-
gasSettings: mintGas
|
|
365
|
-
},
|
|
366
317
|
wait: {
|
|
367
318
|
timeout: this.config.txMinedWaitSeconds
|
|
368
319
|
}
|
|
369
320
|
});
|
|
370
|
-
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}
|
|
371
|
-
|
|
372
|
-
});
|
|
373
|
-
const addLiquidityInteraction = amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce);
|
|
374
|
-
const { estimatedGas: addLiquidityGas } = await addLiquidityInteraction.simulate({
|
|
321
|
+
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}`);
|
|
322
|
+
const { receipt: addLiquidityReceipt } = await amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce).send({
|
|
375
323
|
from: liquidityProvider,
|
|
376
|
-
fee: {
|
|
377
|
-
estimateGas: true
|
|
378
|
-
},
|
|
379
|
-
authWitnesses: [
|
|
380
|
-
token0Authwit,
|
|
381
|
-
token1Authwit
|
|
382
|
-
]
|
|
383
|
-
});
|
|
384
|
-
const { receipt: addLiquidityReceipt } = await addLiquidityInteraction.send({
|
|
385
|
-
from: liquidityProvider,
|
|
386
|
-
fee: {
|
|
387
|
-
gasSettings: addLiquidityGas
|
|
388
|
-
},
|
|
389
324
|
authWitnesses: [
|
|
390
325
|
token0Authwit,
|
|
391
326
|
token1Authwit
|
|
@@ -394,9 +329,7 @@ export class BotFactory {
|
|
|
394
329
|
timeout: this.config.txMinedWaitSeconds
|
|
395
330
|
}
|
|
396
331
|
});
|
|
397
|
-
this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}
|
|
398
|
-
estimatedGas: addLiquidityGas
|
|
399
|
-
});
|
|
332
|
+
this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}`);
|
|
400
333
|
this.log.info(`Liquidity added`);
|
|
401
334
|
const [newT0Bal, newT1Bal, newLPBal] = await getPrivateBalances();
|
|
402
335
|
this.log.info(`Updated private balances of ${defaultAccountAddress} after minting and funding AMM: token0=${newT0Bal}, token1=${newT1Bal}, lp=${newLPBal}`);
|
|
@@ -409,21 +342,10 @@ export class BotFactory {
|
|
|
409
342
|
this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
|
|
410
343
|
await deploy.register();
|
|
411
344
|
} else {
|
|
412
|
-
|
|
413
|
-
...deployOpts,
|
|
414
|
-
fee: {
|
|
415
|
-
estimateGas: true
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
this.log.info(`Deploying contract ${name} at ${address.toString()}`, {
|
|
419
|
-
estimatedGas
|
|
420
|
-
});
|
|
345
|
+
this.log.info(`Deploying contract ${name} at ${address.toString()}`);
|
|
421
346
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
422
347
|
const { txHash } = await deploy.send({
|
|
423
348
|
...deployOpts,
|
|
424
|
-
fee: {
|
|
425
|
-
gasSettings: estimatedGas
|
|
426
|
-
},
|
|
427
349
|
wait: NO_WAIT
|
|
428
350
|
});
|
|
429
351
|
this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
|
|
@@ -463,26 +385,13 @@ export class BotFactory {
|
|
|
463
385
|
const additionalScopes = isStandardToken ? undefined : [
|
|
464
386
|
token.address
|
|
465
387
|
];
|
|
466
|
-
const mintBatch = new BatchCall(token.wallet, calls);
|
|
467
|
-
const { estimatedGas } = await mintBatch.simulate({
|
|
468
|
-
from: minter,
|
|
469
|
-
fee: {
|
|
470
|
-
estimateGas: true
|
|
471
|
-
},
|
|
472
|
-
additionalScopes
|
|
473
|
-
});
|
|
474
388
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
475
|
-
const { txHash } = await
|
|
389
|
+
const { txHash } = await new BatchCall(token.wallet, calls).send({
|
|
476
390
|
from: minter,
|
|
477
391
|
additionalScopes,
|
|
478
|
-
fee: {
|
|
479
|
-
gasSettings: estimatedGas
|
|
480
|
-
},
|
|
481
392
|
wait: NO_WAIT
|
|
482
393
|
});
|
|
483
|
-
this.log.info(`Sent token mint tx with hash ${txHash.toString()}
|
|
484
|
-
estimatedGas
|
|
485
|
-
});
|
|
394
|
+
this.log.info(`Sent token mint tx with hash ${txHash.toString()}`);
|
|
486
395
|
return waitForTx(this.aztecNode, txHash, {
|
|
487
396
|
timeout: this.config.txMinedWaitSeconds
|
|
488
397
|
});
|
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.8c0b8ff",
|
|
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.8c0b8ff",
|
|
58
|
+
"@aztec/aztec.js": "0.0.1-commit.8c0b8ff",
|
|
59
|
+
"@aztec/entrypoints": "0.0.1-commit.8c0b8ff",
|
|
60
|
+
"@aztec/ethereum": "0.0.1-commit.8c0b8ff",
|
|
61
|
+
"@aztec/foundation": "0.0.1-commit.8c0b8ff",
|
|
62
|
+
"@aztec/kv-store": "0.0.1-commit.8c0b8ff",
|
|
63
|
+
"@aztec/l1-artifacts": "0.0.1-commit.8c0b8ff",
|
|
64
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.8c0b8ff",
|
|
65
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.8c0b8ff",
|
|
66
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.8c0b8ff",
|
|
67
|
+
"@aztec/protocol-contracts": "0.0.1-commit.8c0b8ff",
|
|
68
|
+
"@aztec/stdlib": "0.0.1-commit.8c0b8ff",
|
|
69
|
+
"@aztec/telemetry-client": "0.0.1-commit.8c0b8ff",
|
|
70
|
+
"@aztec/wallets": "0.0.1-commit.8c0b8ff",
|
|
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/amm_bot.ts
CHANGED
|
@@ -87,7 +87,7 @@ export class AmmBot extends BaseBot {
|
|
|
87
87
|
authWitnesses: [swapAuthwit],
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
const opts =
|
|
90
|
+
const opts = this.getSendMethodOpts();
|
|
91
91
|
|
|
92
92
|
this.log.verbose(`Sending transaction`, logCtx);
|
|
93
93
|
this.log.info(`Tx. Balances: ${jsonStringify(balances)}`, { ...logCtx, balances });
|
package/src/base_bot.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import {
|
|
2
|
+
import type { SendInteractionOptions } from '@aztec/aztec.js/contracts';
|
|
3
3
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
4
4
|
import { waitForTx } from '@aztec/aztec.js/node';
|
|
5
5
|
import { TxHash, TxReceipt, TxStatus } from '@aztec/aztec.js/tx';
|
|
@@ -56,27 +56,19 @@ export abstract class BaseBot {
|
|
|
56
56
|
return Promise.resolve();
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
protected
|
|
60
|
-
interaction: ContractFunctionInteraction | BatchCall,
|
|
61
|
-
): Promise<SendInteractionOptions> {
|
|
59
|
+
protected getSendMethodOpts(): SendInteractionOptions {
|
|
62
60
|
const { l2GasLimit, daGasLimit, minFeePadding } = this.config;
|
|
63
61
|
|
|
64
62
|
this.wallet.setMinFeePadding(minFeePadding);
|
|
65
63
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.log.verbose(`Estimating gas for transaction`);
|
|
72
|
-
({ estimatedGas: gasSettings } = await interaction.simulate({
|
|
73
|
-
fee: { estimateGas: true },
|
|
74
|
-
from: this.defaultAccountAddress,
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
64
|
+
const gasSettings =
|
|
65
|
+
l2GasLimit !== undefined && l2GasLimit > 0 && daGasLimit !== undefined && daGasLimit > 0
|
|
66
|
+
? { gasLimits: Gas.from({ l2Gas: l2GasLimit, daGas: daGasLimit }) }
|
|
67
|
+
: undefined;
|
|
68
|
+
|
|
77
69
|
return {
|
|
78
70
|
from: this.defaultAccountAddress,
|
|
79
|
-
fee: { gasSettings },
|
|
71
|
+
...(gasSettings ? { fee: { gasSettings } } : {}),
|
|
80
72
|
};
|
|
81
73
|
}
|
|
82
74
|
}
|
package/src/bot.ts
CHANGED
|
@@ -70,10 +70,7 @@ export class Bot extends BaseBot {
|
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
const batch = new BatchCall(wallet, calls);
|
|
73
|
-
const opts =
|
|
74
|
-
|
|
75
|
-
this.log.verbose(`Simulating transaction with ${calls.length}`, logCtx);
|
|
76
|
-
await batch.simulate({ from: this.defaultAccountAddress });
|
|
73
|
+
const opts = this.getSendMethodOpts();
|
|
77
74
|
|
|
78
75
|
this.log.verbose(`Sending transaction`, logCtx);
|
|
79
76
|
const { txHash } = await batch.send({ ...opts, wait: NO_WAIT });
|
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';
|
|
14
15
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
15
16
|
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
|
|
|
@@ -69,9 +69,9 @@ export type BotConfig = {
|
|
|
69
69
|
maxPendingTxs: number;
|
|
70
70
|
/** Whether to flush after sending each 'setup' transaction */
|
|
71
71
|
flushSetupTransactions: boolean;
|
|
72
|
-
/** L2 gas limit for the tx (empty to
|
|
72
|
+
/** L2 gas limit for the tx (empty to let the bot's wallet estimate). */
|
|
73
73
|
l2GasLimit: number | undefined;
|
|
74
|
-
/** DA gas limit for the tx (empty to
|
|
74
|
+
/** DA gas limit for the tx (empty to let the bot's wallet estimate). */
|
|
75
75
|
daGasLimit: number | undefined;
|
|
76
76
|
/** Token contract to use */
|
|
77
77
|
contract: SupportedTokenContracts;
|
|
@@ -130,6 +130,7 @@ export const BotConfigSchema = zodFor<BotConfig>()(
|
|
|
130
130
|
l1Mnemonic: undefined,
|
|
131
131
|
l1PrivateKey: undefined,
|
|
132
132
|
senderPrivateKey: undefined,
|
|
133
|
+
dataDirectory: undefined,
|
|
133
134
|
dataStoreMapSizeKb: 1_024 * 1_024,
|
|
134
135
|
...config,
|
|
135
136
|
})),
|
|
@@ -243,12 +244,12 @@ export const botConfigMappings: ConfigMappingsType<BotConfig> = {
|
|
|
243
244
|
},
|
|
244
245
|
l2GasLimit: {
|
|
245
246
|
env: 'BOT_L2_GAS_LIMIT',
|
|
246
|
-
description:
|
|
247
|
+
description: "L2 gas limit for the tx (empty to let the bot's wallet estimate).",
|
|
247
248
|
...optionalNumberConfigHelper(),
|
|
248
249
|
},
|
|
249
250
|
daGasLimit: {
|
|
250
251
|
env: 'BOT_DA_GAS_LIMIT',
|
|
251
|
-
description:
|
|
252
|
+
description: "DA gas limit for the tx (empty to let the bot's wallet estimate).",
|
|
252
253
|
...optionalNumberConfigHelper(),
|
|
253
254
|
},
|
|
254
255
|
contract: {
|
package/src/cross_chain_bot.ts
CHANGED
|
@@ -137,7 +137,7 @@ export class CrossChainBot extends BaseBot {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
const batch = new BatchCall(this.wallet, calls);
|
|
140
|
-
const opts =
|
|
140
|
+
const opts = this.getSendMethodOpts();
|
|
141
141
|
|
|
142
142
|
this.log.verbose(`Sending cross-chain batch with ${calls.length} calls`, logCtx);
|
|
143
143
|
const { txHash } = await batch.send({ ...opts, wait: NO_WAIT });
|
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,6 @@ 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 { GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
31
32
|
import type { AztecNode, AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
32
33
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
33
34
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
@@ -207,7 +208,7 @@ export class BotFactory {
|
|
|
207
208
|
const signingKey = deriveSigningKey(secret);
|
|
208
209
|
const accountManager = await this.wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
209
210
|
const metadata = await this.wallet.getContractMetadata(accountManager.address);
|
|
210
|
-
if (metadata.
|
|
211
|
+
if (metadata.initializationStatus === ContractInitializationStatus.INITIALIZED) {
|
|
211
212
|
this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
|
|
212
213
|
const timer = new Timer();
|
|
213
214
|
const address = accountManager.address;
|
|
@@ -222,21 +223,14 @@ export class BotFactory {
|
|
|
222
223
|
|
|
223
224
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
|
|
224
225
|
const deployMethod = await accountManager.getDeployMethod();
|
|
225
|
-
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
|
|
226
|
-
|
|
227
|
-
const { estimatedGas } = await deployMethod.simulate({
|
|
228
|
-
from: AztecAddress.ZERO,
|
|
229
|
-
fee: { estimateGas: true, paymentMethod },
|
|
230
|
-
});
|
|
231
|
-
const gasSettings = GasSettings.from({ ...estimatedGas!, maxFeesPerGas, maxPriorityFeesPerGas: GasFees.empty() });
|
|
232
226
|
|
|
233
227
|
await this.withNoMinTxsPerBlock(async () => {
|
|
234
228
|
const { txHash } = await deployMethod.send({
|
|
235
|
-
from:
|
|
236
|
-
fee: {
|
|
229
|
+
from: NO_FROM,
|
|
230
|
+
fee: { paymentMethod },
|
|
237
231
|
wait: NO_WAIT,
|
|
238
232
|
});
|
|
239
|
-
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}
|
|
233
|
+
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`);
|
|
240
234
|
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
241
235
|
});
|
|
242
236
|
this.log.info(`Account deployed at ${address}`);
|
|
@@ -302,9 +296,8 @@ export class BotFactory {
|
|
|
302
296
|
await deploy.register();
|
|
303
297
|
} else {
|
|
304
298
|
this.log.info(`Deploying token contract at ${address.toString()}`);
|
|
305
|
-
const {
|
|
306
|
-
|
|
307
|
-
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`, { estimatedGas });
|
|
299
|
+
const { txHash } = await deploy.send({ ...deployOpts, wait: NO_WAIT });
|
|
300
|
+
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`);
|
|
308
301
|
await this.withNoMinTxsPerBlock(async () => {
|
|
309
302
|
await waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
310
303
|
return token;
|
|
@@ -344,19 +337,10 @@ export class BotFactory {
|
|
|
344
337
|
const amm = AMMContract.at(instance.address, this.wallet);
|
|
345
338
|
|
|
346
339
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
from: deployer,
|
|
350
|
-
|
|
351
|
-
});
|
|
352
|
-
const { receipt: minterReceipt } = await setMinterInteraction.send({
|
|
353
|
-
from: deployer,
|
|
354
|
-
fee: { gasSettings: setMinterGas },
|
|
355
|
-
wait: { timeout: this.config.txMinedWaitSeconds },
|
|
356
|
-
});
|
|
357
|
-
this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}`, {
|
|
358
|
-
estimatedGas: setMinterGas,
|
|
359
|
-
});
|
|
340
|
+
const { receipt: minterReceipt } = await lpToken.methods
|
|
341
|
+
.set_minter(amm.address, true)
|
|
342
|
+
.send({ from: deployer, wait: { timeout: this.config.txMinedWaitSeconds } });
|
|
343
|
+
this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}`);
|
|
360
344
|
this.log.info(`Liquidity token initialized`);
|
|
361
345
|
|
|
362
346
|
return amm;
|
|
@@ -424,44 +408,22 @@ export class BotFactory {
|
|
|
424
408
|
.getFunctionCall(),
|
|
425
409
|
});
|
|
426
410
|
|
|
427
|
-
const
|
|
411
|
+
const { receipt: mintReceipt } = await new BatchCall(this.wallet, [
|
|
428
412
|
token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
429
413
|
token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
430
|
-
]);
|
|
431
|
-
const { estimatedGas: mintGas } = await mintBatch.simulate({
|
|
432
|
-
from: liquidityProvider,
|
|
433
|
-
fee: { estimateGas: true },
|
|
434
|
-
});
|
|
435
|
-
const { receipt: mintReceipt } = await mintBatch.send({
|
|
436
|
-
from: liquidityProvider,
|
|
437
|
-
fee: { gasSettings: mintGas },
|
|
438
|
-
wait: { timeout: this.config.txMinedWaitSeconds },
|
|
439
|
-
});
|
|
414
|
+
]).send({ from: liquidityProvider, wait: { timeout: this.config.txMinedWaitSeconds } });
|
|
440
415
|
|
|
441
|
-
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}
|
|
416
|
+
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}`);
|
|
442
417
|
|
|
443
|
-
const
|
|
444
|
-
amount0Max,
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
const { estimatedGas: addLiquidityGas } = await addLiquidityInteraction.simulate({
|
|
451
|
-
from: liquidityProvider,
|
|
452
|
-
fee: { estimateGas: true },
|
|
453
|
-
authWitnesses: [token0Authwit, token1Authwit],
|
|
454
|
-
});
|
|
455
|
-
const { receipt: addLiquidityReceipt } = await addLiquidityInteraction.send({
|
|
456
|
-
from: liquidityProvider,
|
|
457
|
-
fee: { gasSettings: addLiquidityGas },
|
|
458
|
-
authWitnesses: [token0Authwit, token1Authwit],
|
|
459
|
-
wait: { timeout: this.config.txMinedWaitSeconds },
|
|
460
|
-
});
|
|
418
|
+
const { receipt: addLiquidityReceipt } = await amm.methods
|
|
419
|
+
.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce)
|
|
420
|
+
.send({
|
|
421
|
+
from: liquidityProvider,
|
|
422
|
+
authWitnesses: [token0Authwit, token1Authwit],
|
|
423
|
+
wait: { timeout: this.config.txMinedWaitSeconds },
|
|
424
|
+
});
|
|
461
425
|
|
|
462
|
-
this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}
|
|
463
|
-
estimatedGas: addLiquidityGas,
|
|
464
|
-
});
|
|
426
|
+
this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}`);
|
|
465
427
|
this.log.info(`Liquidity added`);
|
|
466
428
|
|
|
467
429
|
const [newT0Bal, newT1Bal, newLPBal] = await getPrivateBalances();
|
|
@@ -482,10 +444,9 @@ export class BotFactory {
|
|
|
482
444
|
this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
|
|
483
445
|
await deploy.register();
|
|
484
446
|
} else {
|
|
485
|
-
|
|
486
|
-
this.log.info(`Deploying contract ${name} at ${address.toString()}`, { estimatedGas });
|
|
447
|
+
this.log.info(`Deploying contract ${name} at ${address.toString()}`);
|
|
487
448
|
await this.withNoMinTxsPerBlock(async () => {
|
|
488
|
-
const { txHash } = await deploy.send({ ...deployOpts,
|
|
449
|
+
const { txHash } = await deploy.send({ ...deployOpts, wait: NO_WAIT });
|
|
489
450
|
this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
|
|
490
451
|
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
491
452
|
});
|
|
@@ -529,16 +490,13 @@ export class BotFactory {
|
|
|
529
490
|
|
|
530
491
|
// PrivateToken's mint accesses contract-level private storage vars (admin, total_supply).
|
|
531
492
|
const additionalScopes = isStandardToken ? undefined : [token.address];
|
|
532
|
-
const mintBatch = new BatchCall(token.wallet, calls);
|
|
533
|
-
const { estimatedGas } = await mintBatch.simulate({ from: minter, fee: { estimateGas: true }, additionalScopes });
|
|
534
493
|
await this.withNoMinTxsPerBlock(async () => {
|
|
535
|
-
const { txHash } = await
|
|
494
|
+
const { txHash } = await new BatchCall(token.wallet, calls).send({
|
|
536
495
|
from: minter,
|
|
537
496
|
additionalScopes,
|
|
538
|
-
fee: { gasSettings: estimatedGas },
|
|
539
497
|
wait: NO_WAIT,
|
|
540
498
|
});
|
|
541
|
-
this.log.info(`Sent token mint tx with hash ${txHash.toString()}
|
|
499
|
+
this.log.info(`Sent token mint tx with hash ${txHash.toString()}`);
|
|
542
500
|
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
543
501
|
});
|
|
544
502
|
}
|