Merge pull request #193 from propeller-heads/router/dc/ENG-4454-remove-executor-script

chore: Add script to remove executor addresses from Tycho Router
This commit is contained in:
dianacarvalho1
2025-05-15 16:22:52 +01:00
committed by GitHub
3 changed files with 51 additions and 7 deletions

View File

@@ -52,14 +52,14 @@ module.exports = {
etherscan: {
apiKey: process.env.BLOCKCHAIN_EXPLORER_API_KEY,
customChains: [
{
network: "unichain",
chainId: 130,
urls: {
apiURL: "https://api.uniscan.xyz/api",
browserURL: "https://www.uniscan.xyz/"
{
network: "unichain",
chainId: 130,
urls: {
apiURL: "https://api.uniscan.xyz/api",
browserURL: "https://www.uniscan.xyz/"
}
}
}
]
}
};

View File

@@ -48,3 +48,9 @@ For each of the following, you must select one of `tenderly_ethereum`, `tenderly
1. In `scripts/deploy-executors.js` define the executors to be deployed
2. Deploy executors: `npx hardhat run scripts/deploy-executors.js --network NETWORK`
3. Fill in the executor addresses in `config/executor_addresses.json`
### Remove executors
1. If you set a new executor for the same protocol, you need to remove the old one.
2. Run: `npx hardhat run scripts/remove-executor.js --network NETWORK`
3. There will be a prompt for you to insert the executor address you want to remove.

View File

@@ -0,0 +1,38 @@
require('dotenv').config();
const {ethers} = require("hardhat");
const hre = require("hardhat");
const prompt = require('prompt-sync')();
async function main() {
const network = hre.network.name;
const routerAddress = process.env.ROUTER_ADDRESS;
console.log(`Removing executors on TychoRouter at ${routerAddress} on ${network}`);
const [deployer] = await ethers.getSigners();
console.log(`Removing executors with account: ${deployer.address}`);
console.log(`Account balance: ${ethers.utils.formatEther(await deployer.getBalance())} ETH`);
const TychoRouter = await ethers.getContractFactory("TychoRouter");
const router = TychoRouter.attach(routerAddress);
const executorAddress = prompt("Enter executor address to remove: ");
if (!executorAddress) {
console.error("Please provide the executorAddress as an argument.");
process.exit(1);
}
// Remove executor
const tx = await router.removeExecutor(executorAddress, {
gasLimit: 50000
});
await tx.wait(); // Wait for the transaction to be mined
console.log(`Executor removed at transaction: ${tx.hash}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error("Error removing executor:", error);
process.exit(1);
});