- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitor.js
More file actions
Latest commit
25 lines (20 loc) · 935 Bytes
/
Copy pathmonitor.js
File metadata and controls
25 lines (20 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// this was written as a stack answer about monitoring addresses for non-zero balances/ funds being sent to an address
require("dotenv").config();
constNODE_URL=process.env.NODE_URL
letethers=require('ethers');
leturl=NODE_URL;
letprovider=newethers.providers.JsonRpcProvider(url);
constTARGET_ADDRESS1="0x3C283D39436c8F5B48E84740e938C745a45c2Ab1";
constTARGET_ADDRESS2="0x0eE4A43F8E4eaf59886E1118f61c919F9815f59B";
constTARGET_ADDRESS3="0x97ed92E744C10FdD5D403A756239C4069e415e79";
constaddresses=[TARGET_ADDRESS1,TARGET_ADDRESS2,TARGET_ADDRESS3];
for(letaddressofaddresses)getBalance(address);
asyncfunctiongetBalance(address){
constbalance=awaitprovider.getBalance(address);
console.log(`balance at ${address}: ${balance}`);
if(balance>0){
console.log(`deploying contract to : ${address}`)
// pseudo code
// run deploy script passing address
}
}