fix: Unify both executor addresses in one file

- Move executor_addresses.json to a top level directory
- Delete executors.json
- Use the same file for both encoding and setting executors

--- don't change below this line ---
ENG-4260 Took 19 minutes


Took 11 seconds
This commit is contained in:
Diana Carvalho
2025-02-26 10:08:19 +00:00
parent 34563c3eb7
commit 57789a40e4
7 changed files with 17 additions and 16 deletions

View File

@@ -15,7 +15,7 @@ libs = ['lib']
auto_detect_sol = true
evm_version = 'cancun'
optimizer = true
optimizer_runs = 44444444
optimizer_runs = 1000
via_ir = true
[rpc_endpoints]

View File

@@ -9,6 +9,10 @@ module.exports = {
settings: {
evmVersion: "cancun",
viaIR: true,
optimizer: {
enabled: true,
runs: 1000,
},
},
},

View File

@@ -43,4 +43,5 @@ from being stored in the shell history.
1. In `scripts/deploy-executors.js` define the executors to be deployed
2. Deploy executors: `npx hardhat run scripts/deploy-executors.js --network tenderly/mainnet`
3. Fill in the executor addresses in `scripts/executors.json`
3. Fill in the executor addresses in `config/executor_addresses.json`. Note that the naming there needs to match the one
from tycho-indexer.

View File

@@ -1,6 +0,0 @@
[
{
"name": "UniswapV2Executor",
"executor": "0x00C1b81e3C8f6347E69e2DDb90454798A6Be975E"
}
]

View File

@@ -17,15 +17,16 @@ async function main() {
const TychoRouter = await ethers.getContractFactory("TychoRouter");
const router = TychoRouter.attach(routerAddress);
const executorsFilePath = path.join(__dirname, "executors.json");
const executors = JSON.parse(fs.readFileSync(executorsFilePath, "utf8"));
const executorsFilePath = path.join(__dirname, "../../config/executor_addresses.json");
const executors = Object.entries(JSON.parse(fs.readFileSync(executorsFilePath, "utf8"))["ethereum"]);
// Filter out executors that are already set
const executorsToSet = [];
for (const executor of executors) {
const isExecutorSet = await router.executors(executor.executor);
for (const [name, executor] of executors) {
const isExecutorSet = await router.executors(executor);
if (!isExecutorSet) {
executorsToSet.push(executor);
executorsToSet.push({name: name, executor: executor});
}
}
@@ -49,7 +50,9 @@ async function main() {
// Set executors
const executorAddresses = executorsToSet.map(executor => executor.executor);
const tx = await router.setExecutors(executorAddresses);
const tx = await router.setExecutors(executorAddresses, {
gasLimit: 100000
});
await tx.wait(); // Wait for the transaction to be mined
console.log(`Executors set at transaction: ${tx.hash}`);
}