@aztec/bot 0.0.1-commit.d1f2d6c → 0.0.1-commit.d431d1c
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.d.ts +4 -3
- package/dest/amm_bot.d.ts.map +1 -1
- package/dest/amm_bot.js +1 -5
- package/dest/base_bot.d.ts +3 -3
- package/dest/base_bot.d.ts.map +1 -1
- package/dest/base_bot.js +3 -3
- package/dest/bot.d.ts +3 -3
- package/dest/bot.d.ts.map +1 -1
- package/dest/bot.js +2 -5
- package/dest/factory.d.ts +6 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +52 -75
- package/package.json +13 -13
- package/src/amm_bot.ts +4 -4
- package/src/base_bot.ts +8 -4
- package/src/bot.ts +3 -4
- package/src/factory.ts +32 -54
package/dest/amm_bot.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import {
|
|
2
|
+
import { SentTx } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { TxReceipt } from '@aztec/aztec.js/tx';
|
|
3
4
|
import type { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
4
5
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
6
|
import type { AztecNode, AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
@@ -17,7 +18,7 @@ export declare class AmmBot extends BaseBot {
|
|
|
17
18
|
readonly token1: TokenContract;
|
|
18
19
|
protected constructor(node: AztecNode, wallet: TestWallet, defaultAccountAddress: AztecAddress, amm: AMMContract, token0: TokenContract, token1: TokenContract, config: BotConfig);
|
|
19
20
|
static create(config: BotConfig, wallet: TestWallet, aztecNode: AztecNode, aztecNodeAdmin: AztecNodeAdmin | undefined, store: BotStore): Promise<AmmBot>;
|
|
20
|
-
protected createAndSendTx(logCtx: object): Promise<
|
|
21
|
+
protected createAndSendTx(logCtx: object): Promise<SentTx>;
|
|
21
22
|
protected onTxMined(receipt: TxReceipt, logCtx: object): Promise<void>;
|
|
22
23
|
getAmmBalances(): Promise<Balances>;
|
|
23
24
|
getBalances(): Promise<{
|
|
@@ -29,4 +30,4 @@ export declare class AmmBot extends BaseBot {
|
|
|
29
30
|
private getPrivateBalanceFor;
|
|
30
31
|
}
|
|
31
32
|
export {};
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW1tX2JvdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2FtbV9ib3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3pELE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUVuRCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFL0MsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sOEJBQThCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLGNBQWMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pGLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBRTVELE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDeEMsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBRTdDLE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBS2pELEtBQUssUUFBUSxHQUFH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DLENBTXRHO1lBRWEsbUJBQW1CO1lBTW5CLG9CQUFvQjtDQU1uQyJ9
|
package/dest/amm_bot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amm_bot.d.ts","sourceRoot":"","sources":["../src/amm_bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"amm_bot.d.ts","sourceRoot":"","sources":["../src/amm_bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKjD,KAAK,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,qBAAa,MAAO,SAAQ,OAAO;aAKf,GAAG,EAAE,WAAW;aAChB,MAAM,EAAE,aAAa;aACrB,MAAM,EAAE,aAAa;IANvC,SAAS,aACP,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,UAAU,EAClB,qBAAqB,EAAE,YAAY,EACnB,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrC,MAAM,EAAE,SAAS,EAGlB;IAED,OAAa,MAAM,CACjB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,GAAG,SAAS,EAC1C,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,MAAM,CAAC,CASjB;IAED,UAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA0C/D;IAED,UAAyB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGpF;IAEM,cAAc,IAAI,OAAO,CAAC,QAAQ,CAAC,CAEzC;IAEY,WAAW,IAAI,OAAO,CAAC;QAAE,YAAY,EAAE,QAAQ,CAAC;QAAC,aAAa,EAAE,QAAQ,CAAC;QAAC,GAAG,EAAE,QAAQ,CAAA;KAAE,CAAC,CAMtG;YAEa,mBAAmB;YAMnB,oBAAoB;CAMnC"}
|
package/dest/amm_bot.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
1
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
2
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
3
|
import { BaseBot } from './base_bot.js';
|
|
@@ -56,10 +55,7 @@ export class AmmBot extends BaseBot {
|
|
|
56
55
|
...logCtx,
|
|
57
56
|
balances
|
|
58
57
|
});
|
|
59
|
-
return swapExactTokensInteraction.send(
|
|
60
|
-
...opts,
|
|
61
|
-
wait: NO_WAIT
|
|
62
|
-
});
|
|
58
|
+
return swapExactTokensInteraction.send(opts);
|
|
63
59
|
}
|
|
64
60
|
async onTxMined(receipt, logCtx) {
|
|
65
61
|
const balances = await this.getBalances();
|
package/dest/base_bot.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import { BatchCall, ContractFunctionInteraction, type SendInteractionOptions } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import { BatchCall, ContractFunctionInteraction, type SendInteractionOptions, SentTx } 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 { TestWallet } from '@aztec/test-wallet/server';
|
|
@@ -14,8 +14,8 @@ export declare abstract class BaseBot {
|
|
|
14
14
|
protected successes: number;
|
|
15
15
|
protected constructor(node: AztecNode, wallet: TestWallet, defaultAccountAddress: AztecAddress, config: BotConfig);
|
|
16
16
|
run(): Promise<TxReceipt | TxHash>;
|
|
17
|
-
protected abstract createAndSendTx(logCtx: object): Promise<
|
|
17
|
+
protected abstract createAndSendTx(logCtx: object): Promise<SentTx>;
|
|
18
18
|
protected onTxMined(_receipt: TxReceipt, _logCtx: object): Promise<void>;
|
|
19
19
|
protected getSendMethodOpts(interaction: ContractFunctionInteraction | BatchCall): Promise<SendInteractionOptions>;
|
|
20
20
|
}
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV9ib3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9iYXNlX2JvdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDekQsT0FBTyxFQUNMLFNBQVMsRUFDVCwyQkFBMkIsRUFDM0IsS0FBSyxzQkFBc0IsRUFDM0IsTUFBTSxFQUVQLE1BQU0sMkJBQTJCLENBQUM7QUFFbkMsT0FBTyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxvQkFBb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_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,EACL,SAAS,EACT,2BAA2B,EAC3B,KAAK,sBAAsB,
|
|
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,EACL,SAAS,EACT,2BAA2B,EAC3B,KAAK,sBAAsB,EAC3B,MAAM,EAEP,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,8BAAsB,OAAO;aAOT,IAAI,EAAE,SAAS;aACf,MAAM,EAAE,UAAU;aAClB,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,UAAU,EAClB,qBAAqB,EAAE,YAAY,EAC5C,MAAM,EAAE,SAAS,EACtB;IAES,GAAG,IAAI,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,CAkC9C;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,UAAgB,iBAAiB,CAC/B,WAAW,EAAE,2BAA2B,GAAG,SAAS,GACnD,OAAO,CAAC,sBAAsB,CAAC,CAoBjC;CACF"}
|
package/dest/base_bot.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { waitForProven } from '@aztec/aztec.js/contracts';
|
|
2
2
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
|
-
import { waitForTx } from '@aztec/aztec.js/node';
|
|
4
3
|
import { Gas } from '@aztec/stdlib/gas';
|
|
5
4
|
export class BaseBot {
|
|
6
5
|
node;
|
|
@@ -26,13 +25,14 @@ export class BaseBot {
|
|
|
26
25
|
};
|
|
27
26
|
const { followChain, txMinedWaitSeconds } = this.config;
|
|
28
27
|
this.log.verbose(`Creating tx`, logCtx);
|
|
29
|
-
const
|
|
28
|
+
const tx = await this.createAndSendTx(logCtx);
|
|
29
|
+
const txHash = await tx.getTxHash();
|
|
30
30
|
if (followChain === 'NONE') {
|
|
31
31
|
this.log.info(`Transaction ${txHash.toString()} sent, not waiting for it to be mined`);
|
|
32
32
|
return txHash;
|
|
33
33
|
}
|
|
34
34
|
this.log.verbose(`Awaiting tx ${txHash.toString()} to be on the ${followChain} chain (timeout ${txMinedWaitSeconds}s)`, logCtx);
|
|
35
|
-
const receipt = await
|
|
35
|
+
const receipt = await tx.wait({
|
|
36
36
|
timeout: txMinedWaitSeconds
|
|
37
37
|
});
|
|
38
38
|
if (followChain === 'PROVEN') {
|
package/dest/bot.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import {
|
|
2
|
+
import { SentTx } from '@aztec/aztec.js/contracts';
|
|
3
3
|
import type { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
4
4
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
5
|
import type { AztecNode, AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
@@ -13,7 +13,7 @@ export declare class Bot extends BaseBot {
|
|
|
13
13
|
protected constructor(node: AztecNode, wallet: TestWallet, defaultAccountAddress: AztecAddress, token: TokenContract | PrivateTokenContract, recipient: AztecAddress, config: BotConfig);
|
|
14
14
|
static create(config: BotConfig, wallet: TestWallet, aztecNode: AztecNode, aztecNodeAdmin: AztecNodeAdmin | undefined, store: BotStore): Promise<Bot>;
|
|
15
15
|
updateConfig(config: Partial<BotConfig>): void;
|
|
16
|
-
protected createAndSendTx(logCtx: object): Promise<
|
|
16
|
+
protected createAndSendTx(logCtx: object): Promise<SentTx>;
|
|
17
17
|
getBalances(): Promise<{
|
|
18
18
|
sender: {
|
|
19
19
|
privateBalance: bigint;
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm90LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYm90LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQzlELE9BQU8sRUFBYSxNQUFNLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUU5RCxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHVDQUF1QyxDQUFDO0FBQ2xGLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQzt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,UAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA4B/D;IAEY,WAAW;;;;;;;;;OAkBvB;CACF"}
|
package/dest/bot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchCall
|
|
1
|
+
import { BatchCall } from '@aztec/aztec.js/contracts';
|
|
2
2
|
import { times } from '@aztec/foundation/collection';
|
|
3
3
|
import { BaseBot } from './base_bot.js';
|
|
4
4
|
import { BotFactory } from './factory.js';
|
|
@@ -36,10 +36,7 @@ export class Bot extends BaseBot {
|
|
|
36
36
|
from: this.defaultAccountAddress
|
|
37
37
|
});
|
|
38
38
|
this.log.verbose(`Sending transaction`, logCtx);
|
|
39
|
-
return batch.send(
|
|
40
|
-
...opts,
|
|
41
|
-
wait: NO_WAIT
|
|
42
|
-
});
|
|
39
|
+
return batch.send(opts);
|
|
43
40
|
}
|
|
44
41
|
async getBalances() {
|
|
45
42
|
if (isStandardTokenContract(this.token)) {
|
package/dest/factory.d.ts
CHANGED
|
@@ -37,6 +37,11 @@ export declare class BotFactory {
|
|
|
37
37
|
private setupAccountWithPrivateKey;
|
|
38
38
|
private setupTestAccount;
|
|
39
39
|
private setupToken;
|
|
40
|
+
/**
|
|
41
|
+
* Checks if the token contract is deployed and deploys it if necessary.
|
|
42
|
+
* @param wallet - Wallet to deploy the token contract from.
|
|
43
|
+
* @returns The TokenContract instance.
|
|
44
|
+
*/
|
|
40
45
|
private setupTokenContract;
|
|
41
46
|
private setupAmmContract;
|
|
42
47
|
private fundAmm;
|
|
@@ -46,4 +51,4 @@ export declare class BotFactory {
|
|
|
46
51
|
private bridgeL1FeeJuice;
|
|
47
52
|
private withNoMinTxsPerBlock;
|
|
48
53
|
}
|
|
49
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
54
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vd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xDQUFDO1FBQzVCLE1BQU0sRUFBRSxVQUFVLENBQUM7UUFDbkIscUJBQXFCLEVBQUUsWUFBWSxDQUFDO1FBQ3BDLEtBQUssRUFBRSxhQUFhLEdBQUcsb0JBQW9CLENBQUM7UUFDNUMsSUFBSSxFQUFFLFNBQVMsQ0FBQztRQUNoQixTQUFTLEVBQUUsWUFBWSxDQUFDO0tBQ3pCLENBQUMsQ0FNRDtJQUVZLFFBQVEsSUFBSSxPQUFPLENBQUM7UUFDL0IsTUFBTSxFQUFFLFVBQVUsQ0FBQztRQUNuQixxQkFBcUIsRUFBRSxZQUFZLENBQUM7UUFDcEMsR0FBRyxFQUFFLFdBQVcsQ0FBQztRQUNqQixNQUFNLEVBQUUsYUFBYSxDQUFDO1FBQ3RCLE1BQU0sRUFBRSxhQUFhLENBQUM7UUFDdEIsSUFBSSxFQUFFLFNBQVMsQ0FBQztLQUNqQixDQUFDLENBc0JEO1lBTWEsWUFBWTtZQVdaLDBCQUEwQjtZQXdDMUIsZ0JBQWdCO1lBZ0JoQixVQUFVO0lBd0N4Qjs7OztPQUlHO0lBQ0gsT0FBTyxDQUFDLGtCQUFrQjtZQVlaLGdCQUFnQjtZQW9CaEIsT0FBTztZQThFUCx3QkFBd0I7WUF1QnhCLFVBQVU7WUF3Q1Ysc0JBQXNCO1lBNEJ0QixnQkFBZ0I7WUFnQ2hCLG9CQUFvQjtDQWVuQyJ9
|
package/dest/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkBzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D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gBhB,UAAU;IAwCxB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;YAYZ,gBAAgB;YAoBhB,OAAO;YA8EP,wBAAwB;YAuBxB,UAAU;YAwCV,sBAAsB;YA4BtB,gBAAgB;YAgChB,oBAAoB;CAenC"}
|
package/dest/factory.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
3
3
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
-
import { BatchCall
|
|
4
|
+
import { BatchCall } from '@aztec/aztec.js/contracts';
|
|
5
5
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
6
6
|
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
7
7
|
import { deriveKeys } from '@aztec/aztec.js/keys';
|
|
8
8
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
9
9
|
import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
|
|
10
|
-
import { waitForTx } from '@aztec/aztec.js/node';
|
|
11
10
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
12
11
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
13
12
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -109,20 +108,18 @@ export class BotFactory {
|
|
|
109
108
|
const gasSettings = GasSettings.default({
|
|
110
109
|
maxFeesPerGas
|
|
111
110
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
wait: NO_WAIT
|
|
120
|
-
});
|
|
121
|
-
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`);
|
|
122
|
-
return waitForTx(this.aztecNode, txHash, {
|
|
123
|
-
timeout: this.config.txMinedWaitSeconds
|
|
124
|
-
});
|
|
111
|
+
const sentTx = deployMethod.send({
|
|
112
|
+
from: AztecAddress.ZERO,
|
|
113
|
+
fee: {
|
|
114
|
+
gasSettings,
|
|
115
|
+
paymentMethod
|
|
116
|
+
}
|
|
125
117
|
});
|
|
118
|
+
const txHash = await sentTx.getTxHash();
|
|
119
|
+
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`);
|
|
120
|
+
await this.withNoMinTxsPerBlock(()=>sentTx.wait({
|
|
121
|
+
timeout: this.config.txMinedWaitSeconds
|
|
122
|
+
}));
|
|
126
123
|
this.log.info(`Account deployed at ${address}`);
|
|
127
124
|
// Clean up the consumed bridge claim
|
|
128
125
|
await this.store.deleteBridgeClaim(address);
|
|
@@ -151,11 +148,8 @@ export class BotFactory {
|
|
|
151
148
|
contractAddressSalt: this.config.tokenSalt,
|
|
152
149
|
universalDeploy: true
|
|
153
150
|
};
|
|
154
|
-
let token;
|
|
155
151
|
if (this.config.contract === SupportedTokenContracts.TokenContract) {
|
|
156
152
|
deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18);
|
|
157
|
-
tokenInstance = await deploy.getInstance(deployOpts);
|
|
158
|
-
token = TokenContract.at(tokenInstance.address, this.wallet);
|
|
159
153
|
} else if (this.config.contract === SupportedTokenContracts.PrivateTokenContract) {
|
|
160
154
|
// Generate keys for the contract since PrivateToken uses SinglePrivateMutable which requires keys
|
|
161
155
|
const tokenSecretKey = Fr.random();
|
|
@@ -166,7 +160,6 @@ export class BotFactory {
|
|
|
166
160
|
deployOpts.skipInitialization = false;
|
|
167
161
|
// Register the contract with the secret key before deployment
|
|
168
162
|
tokenInstance = await deploy.getInstance(deployOpts);
|
|
169
|
-
token = PrivateTokenContract.at(tokenInstance.address, this.wallet);
|
|
170
163
|
await this.wallet.registerContract(tokenInstance, PrivateTokenContract.artifact, tokenSecretKey);
|
|
171
164
|
} else {
|
|
172
165
|
throw new Error(`Unsupported token contract type: ${this.config.contract}`);
|
|
@@ -175,36 +168,29 @@ export class BotFactory {
|
|
|
175
168
|
const metadata = await this.wallet.getContractMetadata(address);
|
|
176
169
|
if (metadata.isContractPublished) {
|
|
177
170
|
this.log.info(`Token at ${address.toString()} already deployed`);
|
|
178
|
-
|
|
171
|
+
return deploy.register();
|
|
179
172
|
} else {
|
|
180
173
|
this.log.info(`Deploying token contract at ${address.toString()}`);
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
wait: NO_WAIT
|
|
184
|
-
});
|
|
174
|
+
const sentTx = deploy.send(deployOpts);
|
|
175
|
+
const txHash = await sentTx.getTxHash();
|
|
185
176
|
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`);
|
|
186
|
-
|
|
187
|
-
await waitForTx(this.aztecNode, txHash, {
|
|
177
|
+
return this.withNoMinTxsPerBlock(()=>sentTx.deployed({
|
|
188
178
|
timeout: this.config.txMinedWaitSeconds
|
|
189
|
-
});
|
|
190
|
-
return token;
|
|
191
|
-
});
|
|
179
|
+
}));
|
|
192
180
|
}
|
|
193
|
-
return token;
|
|
194
181
|
}
|
|
195
182
|
/**
|
|
196
183
|
* Checks if the token contract is deployed and deploys it if necessary.
|
|
197
184
|
* @param wallet - Wallet to deploy the token contract from.
|
|
198
185
|
* @returns The TokenContract instance.
|
|
199
|
-
*/
|
|
186
|
+
*/ setupTokenContract(deployer, contractAddressSalt, name, ticker, decimals = 18) {
|
|
200
187
|
const deployOpts = {
|
|
201
188
|
from: deployer,
|
|
202
189
|
contractAddressSalt,
|
|
203
190
|
universalDeploy: true
|
|
204
191
|
};
|
|
205
192
|
const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals);
|
|
206
|
-
|
|
207
|
-
return TokenContract.at(instance.address, this.wallet);
|
|
193
|
+
return this.registerOrDeployContract('Token - ' + name, deploy, deployOpts);
|
|
208
194
|
}
|
|
209
195
|
async setupAmmContract(deployer, contractAddressSalt, token0, token1, lpToken) {
|
|
210
196
|
const deployOpts = {
|
|
@@ -213,16 +199,15 @@ export class BotFactory {
|
|
|
213
199
|
universalDeploy: true
|
|
214
200
|
};
|
|
215
201
|
const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address);
|
|
216
|
-
const
|
|
217
|
-
const amm = AMMContract.at(instance.address, this.wallet);
|
|
202
|
+
const amm = await this.registerOrDeployContract('AMM', deploy, deployOpts);
|
|
218
203
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
219
|
-
const
|
|
220
|
-
from: deployer
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
204
|
+
const minterTx = lpToken.methods.set_minter(amm.address, true).send({
|
|
205
|
+
from: deployer
|
|
206
|
+
});
|
|
207
|
+
this.log.info(`Set LP token minter to AMM txHash=${(await minterTx.getTxHash()).toString()}`);
|
|
208
|
+
await minterTx.wait({
|
|
209
|
+
timeout: this.config.txMinedWaitSeconds
|
|
224
210
|
});
|
|
225
|
-
this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}`);
|
|
226
211
|
this.log.info(`Liquidity token initialized`);
|
|
227
212
|
return amm;
|
|
228
213
|
}
|
|
@@ -255,52 +240,46 @@ export class BotFactory {
|
|
|
255
240
|
caller: amm.address,
|
|
256
241
|
call: await token1.methods.transfer_to_public_and_prepare_private_balance_increase(liquidityProvider, amm.address, amount1Max, authwitNonce).getFunctionCall()
|
|
257
242
|
});
|
|
258
|
-
const
|
|
243
|
+
const mintTx = new BatchCall(this.wallet, [
|
|
259
244
|
token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
260
245
|
token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE)
|
|
261
246
|
]).send({
|
|
262
|
-
from: liquidityProvider
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
247
|
+
from: liquidityProvider
|
|
248
|
+
});
|
|
249
|
+
this.log.info(`Sent mint tx: ${(await mintTx.getTxHash()).toString()}`);
|
|
250
|
+
await mintTx.wait({
|
|
251
|
+
timeout: this.config.txMinedWaitSeconds
|
|
266
252
|
});
|
|
267
|
-
|
|
268
|
-
const addLiquidityReceipt = await amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce).send({
|
|
253
|
+
const addLiquidityTx = amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce).send({
|
|
269
254
|
from: liquidityProvider,
|
|
270
255
|
authWitnesses: [
|
|
271
256
|
token0Authwit,
|
|
272
257
|
token1Authwit
|
|
273
|
-
]
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
258
|
+
]
|
|
259
|
+
});
|
|
260
|
+
this.log.info(`Sent tx to add liquidity to the AMM: ${(await addLiquidityTx.getTxHash()).toString()}`);
|
|
261
|
+
await addLiquidityTx.wait({
|
|
262
|
+
timeout: this.config.txMinedWaitSeconds
|
|
277
263
|
});
|
|
278
|
-
this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}`);
|
|
279
264
|
this.log.info(`Liquidity added`);
|
|
280
265
|
const [newT0Bal, newT1Bal, newLPBal] = await getPrivateBalances();
|
|
281
266
|
this.log.info(`Updated private balances of ${defaultAccountAddress} after minting and funding AMM: token0=${newT0Bal}, token1=${newT1Bal}, lp=${newLPBal}`);
|
|
282
267
|
}
|
|
283
268
|
async registerOrDeployContract(name, deploy, deployOpts) {
|
|
284
|
-
const
|
|
285
|
-
const address = instance.address;
|
|
269
|
+
const address = (await deploy.getInstance(deployOpts)).address;
|
|
286
270
|
const metadata = await this.wallet.getContractMetadata(address);
|
|
287
271
|
if (metadata.isContractPublished) {
|
|
288
272
|
this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
|
|
289
|
-
|
|
273
|
+
return deploy.register();
|
|
290
274
|
} else {
|
|
291
275
|
this.log.info(`Deploying contract ${name} at ${address.toString()}`);
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
});
|
|
297
|
-
this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
|
|
298
|
-
return waitForTx(this.aztecNode, txHash, {
|
|
276
|
+
const sentTx = deploy.send(deployOpts);
|
|
277
|
+
const txHash = await sentTx.getTxHash();
|
|
278
|
+
this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
|
|
279
|
+
return this.withNoMinTxsPerBlock(()=>sentTx.deployed({
|
|
299
280
|
timeout: this.config.txMinedWaitSeconds
|
|
300
|
-
});
|
|
301
|
-
});
|
|
281
|
+
}));
|
|
302
282
|
}
|
|
303
|
-
return instance;
|
|
304
283
|
}
|
|
305
284
|
/**
|
|
306
285
|
* Mints private and public tokens for the sender if their balance is below the minimum.
|
|
@@ -327,16 +306,14 @@ export class BotFactory {
|
|
|
327
306
|
this.log.info(`Skipping minting as ${minter.toString()} has enough tokens`);
|
|
328
307
|
return;
|
|
329
308
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
from: minter,
|
|
333
|
-
wait: NO_WAIT
|
|
334
|
-
});
|
|
335
|
-
this.log.info(`Sent token mint tx with hash ${txHash.toString()}`);
|
|
336
|
-
return waitForTx(this.aztecNode, txHash, {
|
|
337
|
-
timeout: this.config.txMinedWaitSeconds
|
|
338
|
-
});
|
|
309
|
+
const sentTx = new BatchCall(token.wallet, calls).send({
|
|
310
|
+
from: minter
|
|
339
311
|
});
|
|
312
|
+
const txHash = await sentTx.getTxHash();
|
|
313
|
+
this.log.info(`Sent token mint tx with hash ${txHash.toString()}`);
|
|
314
|
+
await this.withNoMinTxsPerBlock(()=>sentTx.wait({
|
|
315
|
+
timeout: this.config.txMinedWaitSeconds
|
|
316
|
+
}));
|
|
340
317
|
}
|
|
341
318
|
/**
|
|
342
319
|
* Gets or creates a bridge claim for the recipient.
|
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.d431d1c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -54,18 +54,18 @@
|
|
|
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/noir-contracts.js": "0.0.1-commit.
|
|
64
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
65
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
66
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
67
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
68
|
-
"@aztec/test-wallet": "0.0.1-commit.
|
|
57
|
+
"@aztec/accounts": "0.0.1-commit.d431d1c",
|
|
58
|
+
"@aztec/aztec.js": "0.0.1-commit.d431d1c",
|
|
59
|
+
"@aztec/entrypoints": "0.0.1-commit.d431d1c",
|
|
60
|
+
"@aztec/ethereum": "0.0.1-commit.d431d1c",
|
|
61
|
+
"@aztec/foundation": "0.0.1-commit.d431d1c",
|
|
62
|
+
"@aztec/kv-store": "0.0.1-commit.d431d1c",
|
|
63
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.d431d1c",
|
|
64
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.d431d1c",
|
|
65
|
+
"@aztec/protocol-contracts": "0.0.1-commit.d431d1c",
|
|
66
|
+
"@aztec/stdlib": "0.0.1-commit.d431d1c",
|
|
67
|
+
"@aztec/telemetry-client": "0.0.1-commit.d431d1c",
|
|
68
|
+
"@aztec/test-wallet": "0.0.1-commit.d431d1c",
|
|
69
69
|
"source-map-support": "^0.5.21",
|
|
70
70
|
"tslib": "^2.4.0",
|
|
71
71
|
"zod": "^3.23.8"
|
package/src/amm_bot.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import {
|
|
2
|
+
import { SentTx } from '@aztec/aztec.js/contracts';
|
|
3
3
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
-
import {
|
|
4
|
+
import { TxReceipt } from '@aztec/aztec.js/tx';
|
|
5
5
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
6
6
|
import type { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
7
7
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
@@ -48,7 +48,7 @@ export class AmmBot extends BaseBot {
|
|
|
48
48
|
return new AmmBot(aztecNode, wallet, defaultAccountAddress, amm, token0, token1, config);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
protected async createAndSendTx(logCtx: object): Promise<
|
|
51
|
+
protected async createAndSendTx(logCtx: object): Promise<SentTx> {
|
|
52
52
|
const { feePaymentMethod } = this.config;
|
|
53
53
|
const { wallet, amm, token0, token1 } = this;
|
|
54
54
|
|
|
@@ -89,7 +89,7 @@ export class AmmBot extends BaseBot {
|
|
|
89
89
|
|
|
90
90
|
this.log.verbose(`Sending transaction`, logCtx);
|
|
91
91
|
this.log.info(`Tx. Balances: ${jsonStringify(balances)}`, { ...logCtx, balances });
|
|
92
|
-
return swapExactTokensInteraction.send(
|
|
92
|
+
return swapExactTokensInteraction.send(opts);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
protected override async onTxMined(receipt: TxReceipt, logCtx: object): Promise<void> {
|
package/src/base_bot.ts
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
BatchCall,
|
|
4
4
|
ContractFunctionInteraction,
|
|
5
5
|
type SendInteractionOptions,
|
|
6
|
+
SentTx,
|
|
6
7
|
waitForProven,
|
|
7
8
|
} from '@aztec/aztec.js/contracts';
|
|
8
9
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
9
|
-
import { waitForTx } from '@aztec/aztec.js/node';
|
|
10
10
|
import { TxHash, TxReceipt } from '@aztec/aztec.js/tx';
|
|
11
11
|
import { Gas } from '@aztec/stdlib/gas';
|
|
12
12
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
@@ -33,7 +33,9 @@ export abstract class BaseBot {
|
|
|
33
33
|
const { followChain, txMinedWaitSeconds } = this.config;
|
|
34
34
|
|
|
35
35
|
this.log.verbose(`Creating tx`, logCtx);
|
|
36
|
-
const
|
|
36
|
+
const tx = await this.createAndSendTx(logCtx);
|
|
37
|
+
|
|
38
|
+
const txHash = await tx.getTxHash();
|
|
37
39
|
|
|
38
40
|
if (followChain === 'NONE') {
|
|
39
41
|
this.log.info(`Transaction ${txHash.toString()} sent, not waiting for it to be mined`);
|
|
@@ -44,7 +46,9 @@ export abstract class BaseBot {
|
|
|
44
46
|
`Awaiting tx ${txHash.toString()} to be on the ${followChain} chain (timeout ${txMinedWaitSeconds}s)`,
|
|
45
47
|
logCtx,
|
|
46
48
|
);
|
|
47
|
-
const receipt = await
|
|
49
|
+
const receipt = await tx.wait({
|
|
50
|
+
timeout: txMinedWaitSeconds,
|
|
51
|
+
});
|
|
48
52
|
if (followChain === 'PROVEN') {
|
|
49
53
|
await waitForProven(this.node, receipt, { provenTimeout: txMinedWaitSeconds });
|
|
50
54
|
}
|
|
@@ -59,7 +63,7 @@ export abstract class BaseBot {
|
|
|
59
63
|
return receipt;
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
protected abstract createAndSendTx(logCtx: object): Promise<
|
|
66
|
+
protected abstract createAndSendTx(logCtx: object): Promise<SentTx>;
|
|
63
67
|
|
|
64
68
|
protected onTxMined(_receipt: TxReceipt, _logCtx: object): Promise<void> {
|
|
65
69
|
// no-op
|
package/src/bot.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import { BatchCall,
|
|
3
|
-
import { TxHash } from '@aztec/aztec.js/tx';
|
|
2
|
+
import { BatchCall, SentTx } from '@aztec/aztec.js/contracts';
|
|
4
3
|
import { times } from '@aztec/foundation/collection';
|
|
5
4
|
import type { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
6
5
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
@@ -49,7 +48,7 @@ export class Bot extends BaseBot {
|
|
|
49
48
|
this.config = { ...this.config, ...config };
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
protected async createAndSendTx(logCtx: object): Promise<
|
|
51
|
+
protected async createAndSendTx(logCtx: object): Promise<SentTx> {
|
|
53
52
|
const { privateTransfersPerTx, publicTransfersPerTx, feePaymentMethod } = this.config;
|
|
54
53
|
const { token, recipient, wallet } = this;
|
|
55
54
|
|
|
@@ -76,7 +75,7 @@ export class Bot extends BaseBot {
|
|
|
76
75
|
await batch.simulate({ from: this.defaultAccountAddress });
|
|
77
76
|
|
|
78
77
|
this.log.verbose(`Sending transaction`, logCtx);
|
|
79
|
-
return batch.send(
|
|
78
|
+
return batch.send(opts);
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
public async getBalances() {
|
package/src/factory.ts
CHANGED
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
ContractFunctionInteraction,
|
|
8
8
|
type DeployMethod,
|
|
9
9
|
type DeployOptions,
|
|
10
|
-
NO_WAIT,
|
|
11
10
|
} from '@aztec/aztec.js/contracts';
|
|
12
11
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
13
12
|
import type { L2AmountClaim } from '@aztec/aztec.js/ethereum';
|
|
@@ -15,7 +14,6 @@ import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
|
15
14
|
import { deriveKeys } from '@aztec/aztec.js/keys';
|
|
16
15
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
17
16
|
import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
|
|
18
|
-
import { waitForTx } from '@aztec/aztec.js/node';
|
|
19
17
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
20
18
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
21
19
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -138,16 +136,10 @@ export class BotFactory {
|
|
|
138
136
|
const deployMethod = await accountManager.getDeployMethod();
|
|
139
137
|
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
|
|
140
138
|
const gasSettings = GasSettings.default({ maxFeesPerGas });
|
|
141
|
-
|
|
142
|
-
await
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
fee: { gasSettings, paymentMethod },
|
|
146
|
-
wait: NO_WAIT,
|
|
147
|
-
});
|
|
148
|
-
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`);
|
|
149
|
-
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
150
|
-
});
|
|
139
|
+
const sentTx = deployMethod.send({ from: AztecAddress.ZERO, fee: { gasSettings, paymentMethod } });
|
|
140
|
+
const txHash = await sentTx.getTxHash();
|
|
141
|
+
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`);
|
|
142
|
+
await this.withNoMinTxsPerBlock(() => sentTx.wait({ timeout: this.config.txMinedWaitSeconds }));
|
|
151
143
|
this.log.info(`Account deployed at ${address}`);
|
|
152
144
|
|
|
153
145
|
// Clean up the consumed bridge claim
|
|
@@ -181,11 +173,8 @@ export class BotFactory {
|
|
|
181
173
|
contractAddressSalt: this.config.tokenSalt,
|
|
182
174
|
universalDeploy: true,
|
|
183
175
|
};
|
|
184
|
-
let token: TokenContract | PrivateTokenContract;
|
|
185
176
|
if (this.config.contract === SupportedTokenContracts.TokenContract) {
|
|
186
177
|
deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18);
|
|
187
|
-
tokenInstance = await deploy.getInstance(deployOpts);
|
|
188
|
-
token = TokenContract.at(tokenInstance.address, this.wallet);
|
|
189
178
|
} else if (this.config.contract === SupportedTokenContracts.PrivateTokenContract) {
|
|
190
179
|
// Generate keys for the contract since PrivateToken uses SinglePrivateMutable which requires keys
|
|
191
180
|
const tokenSecretKey = Fr.random();
|
|
@@ -197,7 +186,6 @@ export class BotFactory {
|
|
|
197
186
|
|
|
198
187
|
// Register the contract with the secret key before deployment
|
|
199
188
|
tokenInstance = await deploy.getInstance(deployOpts);
|
|
200
|
-
token = PrivateTokenContract.at(tokenInstance.address, this.wallet);
|
|
201
189
|
await this.wallet.registerContract(tokenInstance, PrivateTokenContract.artifact, tokenSecretKey);
|
|
202
190
|
} else {
|
|
203
191
|
throw new Error(`Unsupported token contract type: ${this.config.contract}`);
|
|
@@ -207,17 +195,14 @@ export class BotFactory {
|
|
|
207
195
|
const metadata = await this.wallet.getContractMetadata(address);
|
|
208
196
|
if (metadata.isContractPublished) {
|
|
209
197
|
this.log.info(`Token at ${address.toString()} already deployed`);
|
|
210
|
-
|
|
198
|
+
return deploy.register();
|
|
211
199
|
} else {
|
|
212
200
|
this.log.info(`Deploying token contract at ${address.toString()}`);
|
|
213
|
-
const
|
|
201
|
+
const sentTx = deploy.send(deployOpts);
|
|
202
|
+
const txHash = await sentTx.getTxHash();
|
|
214
203
|
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`);
|
|
215
|
-
|
|
216
|
-
await waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
217
|
-
return token;
|
|
218
|
-
});
|
|
204
|
+
return this.withNoMinTxsPerBlock(() => sentTx.deployed({ timeout: this.config.txMinedWaitSeconds }));
|
|
219
205
|
}
|
|
220
|
-
return token;
|
|
221
206
|
}
|
|
222
207
|
|
|
223
208
|
/**
|
|
@@ -225,7 +210,7 @@ export class BotFactory {
|
|
|
225
210
|
* @param wallet - Wallet to deploy the token contract from.
|
|
226
211
|
* @returns The TokenContract instance.
|
|
227
212
|
*/
|
|
228
|
-
private
|
|
213
|
+
private setupTokenContract(
|
|
229
214
|
deployer: AztecAddress,
|
|
230
215
|
contractAddressSalt: Fr,
|
|
231
216
|
name: string,
|
|
@@ -234,8 +219,7 @@ export class BotFactory {
|
|
|
234
219
|
): Promise<TokenContract> {
|
|
235
220
|
const deployOpts: DeployOptions = { from: deployer, contractAddressSalt, universalDeploy: true };
|
|
236
221
|
const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals);
|
|
237
|
-
|
|
238
|
-
return TokenContract.at(instance.address, this.wallet);
|
|
222
|
+
return this.registerOrDeployContract('Token - ' + name, deploy, deployOpts);
|
|
239
223
|
}
|
|
240
224
|
|
|
241
225
|
private async setupAmmContract(
|
|
@@ -247,14 +231,12 @@ export class BotFactory {
|
|
|
247
231
|
): Promise<AMMContract> {
|
|
248
232
|
const deployOpts: DeployOptions = { from: deployer, contractAddressSalt, universalDeploy: true };
|
|
249
233
|
const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address);
|
|
250
|
-
const
|
|
251
|
-
const amm = AMMContract.at(instance.address, this.wallet);
|
|
234
|
+
const amm = await this.registerOrDeployContract('AMM', deploy, deployOpts);
|
|
252
235
|
|
|
253
236
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}`);
|
|
237
|
+
const minterTx = lpToken.methods.set_minter(amm.address, true).send({ from: deployer });
|
|
238
|
+
this.log.info(`Set LP token minter to AMM txHash=${(await minterTx.getTxHash()).toString()}`);
|
|
239
|
+
await minterTx.wait({ timeout: this.config.txMinedWaitSeconds });
|
|
258
240
|
this.log.info(`Liquidity token initialized`);
|
|
259
241
|
|
|
260
242
|
return amm;
|
|
@@ -313,22 +295,23 @@ export class BotFactory {
|
|
|
313
295
|
.getFunctionCall(),
|
|
314
296
|
});
|
|
315
297
|
|
|
316
|
-
const
|
|
298
|
+
const mintTx = new BatchCall(this.wallet, [
|
|
317
299
|
token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
318
300
|
token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
319
|
-
]).send({ from: liquidityProvider
|
|
301
|
+
]).send({ from: liquidityProvider });
|
|
320
302
|
|
|
321
|
-
this.log.info(`Sent mint tx: ${
|
|
303
|
+
this.log.info(`Sent mint tx: ${(await mintTx.getTxHash()).toString()}`);
|
|
304
|
+
await mintTx.wait({ timeout: this.config.txMinedWaitSeconds });
|
|
322
305
|
|
|
323
|
-
const
|
|
306
|
+
const addLiquidityTx = amm.methods
|
|
324
307
|
.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce)
|
|
325
308
|
.send({
|
|
326
309
|
from: liquidityProvider,
|
|
327
310
|
authWitnesses: [token0Authwit, token1Authwit],
|
|
328
|
-
wait: { timeout: this.config.txMinedWaitSeconds },
|
|
329
311
|
});
|
|
330
312
|
|
|
331
|
-
this.log.info(`Sent tx to add liquidity to the AMM: ${
|
|
313
|
+
this.log.info(`Sent tx to add liquidity to the AMM: ${(await addLiquidityTx.getTxHash()).toString()}`);
|
|
314
|
+
await addLiquidityTx.wait({ timeout: this.config.txMinedWaitSeconds });
|
|
332
315
|
this.log.info(`Liquidity added`);
|
|
333
316
|
|
|
334
317
|
const [newT0Bal, newT1Bal, newLPBal] = await getPrivateBalances();
|
|
@@ -341,22 +324,19 @@ export class BotFactory {
|
|
|
341
324
|
name: string,
|
|
342
325
|
deploy: DeployMethod<T>,
|
|
343
326
|
deployOpts: DeployOptions,
|
|
344
|
-
): Promise<
|
|
345
|
-
const
|
|
346
|
-
const address = instance.address;
|
|
327
|
+
): Promise<T> {
|
|
328
|
+
const address = (await deploy.getInstance(deployOpts)).address;
|
|
347
329
|
const metadata = await this.wallet.getContractMetadata(address);
|
|
348
330
|
if (metadata.isContractPublished) {
|
|
349
331
|
this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
|
|
350
|
-
|
|
332
|
+
return deploy.register();
|
|
351
333
|
} else {
|
|
352
334
|
this.log.info(`Deploying contract ${name} at ${address.toString()}`);
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
});
|
|
335
|
+
const sentTx = deploy.send(deployOpts);
|
|
336
|
+
const txHash = await sentTx.getTxHash();
|
|
337
|
+
this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
|
|
338
|
+
return this.withNoMinTxsPerBlock(() => sentTx.deployed({ timeout: this.config.txMinedWaitSeconds }));
|
|
358
339
|
}
|
|
359
|
-
return instance;
|
|
360
340
|
}
|
|
361
341
|
|
|
362
342
|
/**
|
|
@@ -392,12 +372,10 @@ export class BotFactory {
|
|
|
392
372
|
this.log.info(`Skipping minting as ${minter.toString()} has enough tokens`);
|
|
393
373
|
return;
|
|
394
374
|
}
|
|
395
|
-
|
|
396
|
-
await
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
return waitForTx(this.aztecNode, txHash, { timeout: this.config.txMinedWaitSeconds });
|
|
400
|
-
});
|
|
375
|
+
const sentTx = new BatchCall(token.wallet, calls).send({ from: minter });
|
|
376
|
+
const txHash = await sentTx.getTxHash();
|
|
377
|
+
this.log.info(`Sent token mint tx with hash ${txHash.toString()}`);
|
|
378
|
+
await this.withNoMinTxsPerBlock(() => sentTx.wait({ timeout: this.config.txMinedWaitSeconds }));
|
|
401
379
|
}
|
|
402
380
|
|
|
403
381
|
/**
|