Skip to content

Commit

Permalink
Merge pull request #91 from propeller-heads/router/dc/ENG-4251-verify…
Browse files Browse the repository at this point in the history
…-on-etherscan

feat: Verify contracts on etherscan
  • Loading branch information
dianacarvalho1 authored Feb 27, 2025
2 parents 87e7394 + fedc504 commit 6a1e78a
Show file tree
Hide file tree
Showing 33 changed files with 81 additions and 233 deletions.
8 changes: 4 additions & 4 deletions config/executor_addresses.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"ethereum": {
"uniswap_v2": "0x00C1b81e3C8f6347E69e2DDb90454798A6Be975E",
"uniswap_v3": "0xF744EBfaA580cF3fFc25aD046E92BD8B770a0700",
"uniswap_v4": "0x90BE4620436354c9DfA58614B3Bdd5a80FBfAF31",
"vm:balancer_v2": "0xffe5B139b396c9A3d5d9ab89AAE78bF3070CbD64"
"uniswap_v2": "0xf6c5be66FFf9DC69962d73da0A617a827c382329",
"uniswap_v3": "0xdD8559c917393FC8DD2b4dD289c52Ff445fDE1B0",
"uniswap_v4": "0x042C0ebBEAb9d9987c2f64Ee05f2B3aeB86eAf70",
"vm:balancer_v2": "0x00BE8EfAE40219Ff76287b0F9b9e497942f5BC91"
},
"tenderly_ethereum": {
"uniswap_v2": "0x00C1b81e3C8f6347E69e2DDb90454798A6Be975E",
Expand Down
7 changes: 6 additions & 1 deletion foundry/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type import('hardhat/config').HardhatUserConfig */
require("@tenderly/hardhat-tenderly");
require("@nomicfoundation/hardhat-verify");
require("@nomiclabs/hardhat-ethers");
require("@nomicfoundation/hardhat-foundry");

Expand Down Expand Up @@ -40,6 +41,10 @@ module.exports = {
tenderly: {
project: "project",
username: "tvinagre",
privateVerification: true,
privateVerification: false,
},

etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
}
};
2 changes: 1 addition & 1 deletion foundry/interfaces/ICallback.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;

interface ICallback {
Expand Down
2 changes: 1 addition & 1 deletion foundry/interfaces/IExecutor.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion foundry/lib/IWETH.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion foundry/lib/LibSwap.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;

library LibSwap {
Expand Down
110 changes: 0 additions & 110 deletions foundry/lib/Payments.sol

This file was deleted.

23 changes: 0 additions & 23 deletions foundry/lib/PaymentsImmutables.sol

This file was deleted.

57 changes: 0 additions & 57 deletions foundry/lib/Permit2Payments.sol

This file was deleted.

2 changes: 1 addition & 1 deletion foundry/lib/bytes/LibPrefixLengthEncodedByteArray.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;

/**
Expand Down
7 changes: 4 additions & 3 deletions foundry/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions foundry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "hardhat-project",
"devDependencies": {
"@nomicfoundation/hardhat-verify": "^2.0.13",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@tenderly/hardhat-tenderly": "^2.5.2",
"dotenv": "^16.4.7",
Expand Down
3 changes: 2 additions & 1 deletion foundry/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## Deploy on a Tenderly fork

1. Make a new [fork](https://dashboard.tenderly.co/) in tenderly dashboard for the
1. Make a new [fork](https://dashboard.tenderly.co/) in tenderly dashboard for the
chain that you wish to deploy on.
2. Set the following environment variables:

Expand All @@ -25,6 +25,7 @@ export PRIVATE_KEY=<private-key>
export RPC_URL=<chain-rpc-url>
export DEPLOY_WALLET=<wallet-address>
export PRIVATE_KEY=<private-key>
export ETHERSCAN_API_KEY=<etherscan-api-key>
```

Make sure to run `unset HISTFILE` in your terminal before setting the private key. This will prevent the private key
Expand Down
20 changes: 17 additions & 3 deletions foundry/scripts/deploy-executors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const hre = require("hardhat");
// Comment out the executors you don't want to deploy
const executors_to_deploy = [
{exchange: "UniswapV2Executor", args: []},
// {exchange: "UniswapV3Executor", args: ["0x1F98431c8aD98523631AE4a59f267346ea31F984"]},
// {exchange: "UniswapV4Executor", args: ["0x000000000004444c5dc75cB358380D2e3dE08A90"]},
// {exchange: "BalancerV2Executor", args: []},
{exchange: "UniswapV3Executor", args: ["0x1F98431c8aD98523631AE4a59f267346ea31F984"]},
{exchange: "UniswapV4Executor", args: ["0x000000000004444c5dc75cB358380D2e3dE08A90"]},
{exchange: "BalancerV2Executor", args: []},
]

async function main() {
Expand All @@ -25,6 +25,7 @@ async function main() {
await deployedExecutor.deployed();
console.log(`${exchange} deployed to: ${deployedExecutor.address}`);

// Verify on Tenderly
try {
await hre.tenderly.verify({
name: exchange,
Expand All @@ -34,6 +35,19 @@ async function main() {
} catch (error) {
console.error("Error during contract verification:", error);
}

console.log("Waiting for 1 minute before verifying the contract...");
await new Promise(resolve => setTimeout(resolve, 60000));
// Verify on Etherscan
try {
await hre.run("verify:verify", {
address: deployedExecutor.address,
constructorArguments: args,
});
console.log(`${exchange} verified successfully on Etherscan!`);
} catch (error) {
console.error(`Error during Etherscan verification:`, error);
}
}
}

Expand Down
20 changes: 18 additions & 2 deletions foundry/scripts/deploy-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ async function main() {
const network = hre.network.name;
let permit2;
let weth;
if (network === "mainnet" || network === "tenderly_mainnet") {
if (network === "ethereum" || network === "tenderly_ethereum") {
permit2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
} else if (network === "base" || network === "tenderly_base") {
// permit2 address is the same as on mainnet
// permit2 address is the same as on ethereum
permit2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
weth = "0x4200000000000000000000000000000000000006";
} else {
Expand All @@ -31,6 +31,7 @@ async function main() {
await router.deployed();
console.log(`TychoRouter deployed to: ${router.address}`);

// Verify on Tenderly
try {
console.log("Verifying contract on Tenderly...");
await hre.tenderly.verify({
Expand All @@ -41,6 +42,21 @@ async function main() {
} catch (error) {
console.error("Error during contract verification:", error);
}

console.log("Waiting for 1 minute before verifying the contract...");
await new Promise(resolve => setTimeout(resolve, 60000));

// Verify on Etherscan
try {
await hre.run("verify:verify", {
address: router.address,
constructorArguments: [permit2, weth],
});
console.log(`TychoRouter verified successfully on Etherscan!`);
} catch (error) {
console.error(`Error during Etherscan verification:`, error);
}

}

main()
Expand Down
2 changes: 1 addition & 1 deletion foundry/src/Dispatcher.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;

import "@interfaces/IExecutor.sol";
Expand Down
2 changes: 1 addition & 1 deletion foundry/src/TychoRouter.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;

import "../lib/IWETH.sol";
Expand Down
Loading

0 comments on commit 6a1e78a

Please sign in to comment.