Skip to content

Instantly share code, notes, and snippets.

@aeither
Created September 11, 2022 08:05
Show Gist options
  • Save aeither/0add4a5e7550b04706d7241a71583ddd to your computer and use it in GitHub Desktop.
Save aeither/0add4a5e7550b04706d7241a71583ddd to your computer and use it in GitHub Desktop.
import { ethers } from "ethers";
import * as dotenv from "dotenv";
dotenv.config();
async function main() {
const API_KEY = process.env.API_KEY;
if (!API_KEY) {
console.log("No api key");
return;
}
const list = [
];
const provider = new ethers.providers.AlchemyProvider("rinkeby");
let contractAddresses = [""];
list.map(async (address) => {
const isCode = await provider.getCode(address);
const val = isCode.length > 2 ? address : "No Contract";
console.log("val", val);
if (val == "No Contract") {
contractAddresses.push(address);
}
});
console.log("contractAddresses", contractAddresses);
}
main()
.then(async () => {})
.catch(async (e) => {
console.error(e);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment