Compare commits
No commits in common. "dev" and "main" have entirely different histories.
@ -187,7 +187,7 @@ func getAlchemyTokenTransfers(address string, contractAddress string, fromBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
// HTTP POST 요청
|
// HTTP POST 요청
|
||||||
// umlog.Debug("Request - Address: %s, From: %s, To: %s", address, fromBlock, toBlock)
|
umlog.Debug("Request - Address: %s, From: %s, To: %s", address, fromBlock, toBlock)
|
||||||
// umlog.Debug("[getAlchemyTokenTransfers] Padded address (topic[2]): %s\n", paddedAddress)
|
// umlog.Debug("[getAlchemyTokenTransfers] Padded address (topic[2]): %s\n", paddedAddress)
|
||||||
// umlog.Debug("[getAlchemyTokenTransfers] Request body: %s", string(requestBody))
|
// umlog.Debug("[getAlchemyTokenTransfers] Request body: %s", string(requestBody))
|
||||||
req, err := http.NewRequest("POST", CODE_STRC.ALCHEMY_MAINNET, bytes.NewBuffer(requestBody))
|
req, err := http.NewRequest("POST", CODE_STRC.ALCHEMY_MAINNET, bytes.NewBuffer(requestBody))
|
||||||
@ -444,7 +444,7 @@ func checkWalletWithAlchemy(walletDBConn *sql.DB, header model.Header, userId in
|
|||||||
fromBlockHex := fmt.Sprintf("0x%x", startBlock)
|
fromBlockHex := fmt.Sprintf("0x%x", startBlock)
|
||||||
toBlockHex := fmt.Sprintf("0x%x", currentBlock)
|
toBlockHex := fmt.Sprintf("0x%x", currentBlock)
|
||||||
|
|
||||||
// umlog.Debug("Checking blocks %d to %d (range: %d)\n", startBlock, currentBlock, blocksToCheck)
|
umlog.Debug("Checking blocks %d to %d (range: %d)\n", startBlock, currentBlock, blocksToCheck)
|
||||||
|
|
||||||
// Alchemy API로 Transfer 이벤트 조회
|
// Alchemy API로 Transfer 이벤트 조회
|
||||||
transfers, err := getAlchemyTokenTransfers(walletAddress, contractAddress, fromBlockHex, toBlockHex, CODE_STRC)
|
transfers, err := getAlchemyTokenTransfers(walletAddress, contractAddress, fromBlockHex, toBlockHex, CODE_STRC)
|
||||||
@ -459,12 +459,12 @@ func checkWalletWithAlchemy(walletDBConn *sql.DB, header model.Header, userId in
|
|||||||
umlog.Debug("transfer info: %v\n", transfer)
|
umlog.Debug("transfer info: %v\n", transfer)
|
||||||
|
|
||||||
// 트랜잭션 시각 체크 (Timestamp 사용)
|
// 트랜잭션 시각 체크 (Timestamp 사용)
|
||||||
// txTime := time.Unix(transfer.Timestamp, 0)
|
txTime := time.Unix(transfer.Timestamp, 0)
|
||||||
|
|
||||||
// 마지막 체크 이후의 트랜잭션만 처리
|
// 마지막 체크 이후의 트랜잭션만 처리
|
||||||
// if txTime.Before(lastCheckTime) {
|
if txTime.Before(lastCheckTime) {
|
||||||
// continue
|
continue
|
||||||
// }
|
}
|
||||||
|
|
||||||
// 이미 알림 보낸 트랜잭션인지 확인
|
// 이미 알림 보낸 트랜잭션인지 확인
|
||||||
if isTransactionNotified(walletDBConn, transfer.TransactionHash) {
|
if isTransactionNotified(walletDBConn, transfer.TransactionHash) {
|
||||||
@ -482,8 +482,8 @@ func checkWalletWithAlchemy(walletDBConn *sql.DB, header model.Header, userId in
|
|||||||
|
|
||||||
newTransactionCount++
|
newTransactionCount++
|
||||||
|
|
||||||
// umlog.Info("checkWalletWithAlchemy\nNew incoming tx detected - User: %d, From: %s, Amount: %s CYBX, Hash: %s",
|
umlog.Info("checkWalletWithAlchemy\nNew incoming tx detected - User: %d, From: %s, Amount: %s CYBX, Hash: %s",
|
||||||
// userId, transfer.From, amount, transfer.TransactionHash)
|
userId, transfer.From, amount, transfer.TransactionHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
return newTransactionCount, nil
|
return newTransactionCount, nil
|
||||||
@ -682,8 +682,8 @@ func sendIncomingTransactionNotification(walletDBConn *sql.DB, header model.Head
|
|||||||
|
|
||||||
// Telegram 알림 (관리자용)
|
// Telegram 알림 (관리자용)
|
||||||
messageboxy := fmt.Sprintf(
|
messageboxy := fmt.Sprintf(
|
||||||
"💰 Deposit notification(from Alchemy)\nFrom: %s\nAmount: %s CYBX\nTxHash: %s\n",
|
"💰 Deposit notification(from Alchemy)\nFrom: %s\nTo: %s\nAmount: %s CYBX\nTxHash: %s",
|
||||||
fromAddress, amount, txHash)
|
fromAddress, toAddress, amount, txHash)
|
||||||
message := map[string]string{"message": messageboxy}
|
message := map[string]string{"message": messageboxy}
|
||||||
jsonData, err := json.Marshal(message)
|
jsonData, err := json.Marshal(message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user