File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import {
3737 getSignature ,
3838 getSigner ,
3939 handleOneTimeApproval ,
40+ logBalance ,
4041} from "../../utils/onchain-allocator" ;
4142import { config } from "../../config" ;
4243import {
@@ -107,6 +108,8 @@ export class RequestHandlerService {
107108
108109 // This is needed before being able to submit withdraw requests
109110 await handleOneTimeApproval ( ) ;
111+ // Log the balance of the onchain-allocator sender wallet for tracking purposes
112+ await logBalance ( ) ;
110113
111114 const txHash = await contract . write . submitWithdrawRequest ( [
112115 payloadParams as any ,
@@ -252,6 +255,8 @@ export class RequestHandlerService {
252255
253256 // This is needed before being able to submit withdraw requests
254257 await handleOneTimeApproval ( ) ;
258+ // Log the balance of the onchain-allocator sender wallet for tracking purposes
259+ await logBalance ( ) ;
255260
256261 const txHash = await contract . write . submitWithdrawRequest ( [
257262 payloadParams as any ,
Original file line number Diff line number Diff line change @@ -12,12 +12,14 @@ import {
1212 parseAbi ,
1313 zeroAddress ,
1414 maxUint256 ,
15+ formatUnits ,
1516} from "viem" ;
1617import { privateKeyToAccount , publicKeyToAddress } from "viem/accounts" ;
1718
1819import { KmsSigner } from "./viem-kms-signer" ;
1920import { getChain } from "../common/chains" ;
2021import { externalError } from "../common/error" ;
22+ import { logger } from "../common/logger" ;
2123import { config } from "../config" ;
2224import { getWithdrawalRequest } from "../models/withdrawal-requests" ;
2325
@@ -114,6 +116,21 @@ export const getOnchainAllocator = async () => {
114116 } ;
115117} ;
116118
119+ export const logBalance = async ( ) => {
120+ const { walletClient, publicClient } = await getPublicAndWalletClients ( ) ;
121+
122+ const balance = await publicClient . getBalance ( {
123+ address : walletClient . account . address ,
124+ } ) ;
125+ logger . info (
126+ "balance" ,
127+ JSON . stringify ( {
128+ msg : "Balance of onchain-allocator sender wallet" ,
129+ balance : Number ( formatUnits ( balance , 18 ) ) ,
130+ } )
131+ ) ;
132+ } ;
133+
117134let _allowanceCache : bigint | undefined ;
118135export const handleOneTimeApproval = async ( ) => {
119136 const { walletClient } = await getPublicAndWalletClients ( ) ;
You can’t perform that action at this time.
0 commit comments