From 5af0863a1311dc64d6d804f6d5908d2131079b6f Mon Sep 17 00:00:00 2001 From: gaetbout Date: Wed, 17 Apr 2024 11:21:48 +0200 Subject: [PATCH] small fixes --- lib/accounts.ts | 4 +++- lib/contracts.ts | 1 + lib/index.ts | 3 +++ scripts/deploy-accounts.ts | 6 +++--- scripts/fund-accounts.ts | 2 +- scripts/stress-test.ts | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/accounts.ts b/lib/accounts.ts index 72ea2f9..1cc89ef 100644 --- a/lib/accounts.ts +++ b/lib/accounts.ts @@ -16,7 +16,9 @@ import { num, uint256, } from "starknet"; -import { ArgentSigner, KeyPair, ethAddress, loadContract, provider, randomStarknetKeyPair, strkAddress } from "."; +import { ArgentSigner, KeyPair, ethAddress, loadContract, randomStarknetKeyPair, strkAddress } from "."; +import { provider } from "./provider"; + export class ArgentAccount extends Account { // Increase the gas limit by 30% to avoid failures due to gas estimation being too low with tx v3 and transactions the use escaping override async deployAccount( diff --git a/lib/contracts.ts b/lib/contracts.ts index 5361fcb..6828aec 100644 --- a/lib/contracts.ts +++ b/lib/contracts.ts @@ -16,6 +16,7 @@ export async function loadContract(contractAddress: string, retry = 0): Promise< } return new Contract(abi, contractAddress, provider); } catch (e) { + console.log(`Failing to loadContract for ${contractAddress}, retrying... (${retry})`); if (retry >= 3) { console.log(e); // If this isn't working we can fail diff --git a/lib/index.ts b/lib/index.ts index abbd0fa..33cdef3 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,3 +1,6 @@ +import dotenv from "dotenv"; +dotenv.config({ override: true }); + export * from "./accounts"; export * from "./contracts"; export * from "./provider"; diff --git a/scripts/deploy-accounts.ts b/scripts/deploy-accounts.ts index 669a36f..a42b40f 100644 --- a/scripts/deploy-accounts.ts +++ b/scripts/deploy-accounts.ts @@ -7,8 +7,8 @@ dotenv.config({ override: true }); // Update theses const accountClassHash = process.env.ARGENT_CLASS_HASH; -const ethFundingAmount = BigInt(1e17); -const strkFundingAmount = BigInt(1e16); +const ethFundingAmount = BigInt(1e16); +const strkFundingAmount = BigInt(1e17); // Fixed constants const selfDeploy = true; @@ -52,7 +52,7 @@ async function safeDeployAccount(params: DeployAccountParams, retry = 0): Promis const { account } = await deployAccountWithoutGuardian(params); return account; } catch (e) { - console.log(`Failing to deploy, retrying... ${retry}`); + console.log(`Failing to deploy, retrying... (${retry})`); if (retry >= 3) { console.log(e); return; diff --git a/scripts/fund-accounts.ts b/scripts/fund-accounts.ts index 9cb0d83..4891189 100644 --- a/scripts/fund-accounts.ts +++ b/scripts/fund-accounts.ts @@ -42,7 +42,7 @@ async function safeBalanceOf(contract: Contract, address: string, retry = 0) { try { return await contract.balanceOf(address); } catch (e) { - console.log(`Failing to get balance, retrying... ${retry}`); + console.log(`Failing to get balance, retrying... (${retry})`); if (retry >= 5) { console.log(e); return; diff --git a/scripts/stress-test.ts b/scripts/stress-test.ts index 2c6abbc..8acf7c4 100644 --- a/scripts/stress-test.ts +++ b/scripts/stress-test.ts @@ -8,7 +8,7 @@ const aimTPS = 3; const timeInSeconds = 5; const ratioTxV3 = 0.6; const maxFee = 1e15; -const l1_gas = { max_amount: "0x100", max_price_per_unit: num.toHex(1e15) }; +const l1_gas = { max_amount: "0x1000", max_price_per_unit: num.toHex(1e14) }; // Fixed constants const v3Amount = Math.ceil(aimTPS * ratioTxV3);