Merge pull request #85 from propeller-heads/router/tnl/ENG-4269-base-deployment
feat: support base deployment
This commit is contained in:
@@ -4,5 +4,17 @@
|
|||||||
"uniswap_v3": "0x5C2F5a71f67c01775180ADc06909288B4C329308",
|
"uniswap_v3": "0x5C2F5a71f67c01775180ADc06909288B4C329308",
|
||||||
"uniswap_v4": "0xF62849F9A0B5Bf2913b396098F7c7019b51A820a",
|
"uniswap_v4": "0xF62849F9A0B5Bf2913b396098F7c7019b51A820a",
|
||||||
"vm:balancer_v2": "0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"
|
"vm:balancer_v2": "0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"
|
||||||
|
},
|
||||||
|
"tenderly_ethereum": {
|
||||||
|
"uniswap_v2": "0x00C1b81e3C8f6347E69e2DDb90454798A6Be975E",
|
||||||
|
"uniswap_v3": "0x5C2F5a71f67c01775180ADc06909288B4C329308",
|
||||||
|
"uniswap_v4": "0xF62849F9A0B5Bf2913b396098F7c7019b51A820a",
|
||||||
|
"vm:balancer_v2": "0x543778987b293C7E8Cf0722BB2e935ba6f4068D4"
|
||||||
|
},
|
||||||
|
"base": {
|
||||||
|
"uniswap_v2": "0x2DaE954eCF457276F90B68Cee68981C0aA07f2ef"
|
||||||
|
},
|
||||||
|
"tenderly_base": {
|
||||||
|
"uniswap_v3": "0x7c7E06d7317e620a185078e236879D2a87fC8d22"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,11 +17,19 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
networks: {
|
networks: {
|
||||||
tenderly: {
|
tenderly_ethereum: {
|
||||||
url: process.env.RPC_URL,
|
url: process.env.RPC_URL,
|
||||||
accounts: [process.env.PRIVATE_KEY]
|
accounts: [process.env.PRIVATE_KEY]
|
||||||
},
|
},
|
||||||
mainnet: {
|
tenderly_base: {
|
||||||
|
url: process.env.RPC_URL,
|
||||||
|
accounts: [process.env.PRIVATE_KEY]
|
||||||
|
},
|
||||||
|
ethereum: {
|
||||||
|
url: process.env.RPC_URL,
|
||||||
|
accounts: [process.env.PRIVATE_KEY]
|
||||||
|
},
|
||||||
|
base: {
|
||||||
url: process.env.RPC_URL,
|
url: process.env.RPC_URL,
|
||||||
accounts: [process.env.PRIVATE_KEY]
|
accounts: [process.env.PRIVATE_KEY]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
## Deploy on a Tenderly fork
|
## Deploy on a Tenderly fork
|
||||||
|
|
||||||
1. Make a new [fork](https://dashboard.tenderly.co/) in tenderly dashboard.
|
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:
|
2. Set the following environment variables:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -16,12 +17,12 @@ export PRIVATE_KEY=<private-key>
|
|||||||
|
|
||||||
3. Fund wallet: `npx hardhat run scripts/fund-wallet-tenderly-fork.js --network tenderly`
|
3. Fund wallet: `npx hardhat run scripts/fund-wallet-tenderly-fork.js --network tenderly`
|
||||||
|
|
||||||
## Deploy on mainnet
|
## Deploy on Ethereum Mainnet or Base
|
||||||
|
|
||||||
1. Set the following environment variables:
|
1. Set the following environment variables:
|
||||||
|
|
||||||
```
|
```
|
||||||
export RPC_URL=<mainnet-rpc-url>
|
export RPC_URL=<chain-rpc-url>
|
||||||
export DEPLOY_WALLET=<wallet-address>
|
export DEPLOY_WALLET=<wallet-address>
|
||||||
export PRIVATE_KEY=<private-key>
|
export PRIVATE_KEY=<private-key>
|
||||||
```
|
```
|
||||||
@@ -31,17 +32,18 @@ from being stored in the shell history.
|
|||||||
|
|
||||||
## Deploy Tycho Router
|
## Deploy Tycho Router
|
||||||
|
|
||||||
1. Deploy router: `npx hardhat run scripts/deploy-router.js --network tenderly/mainnet`
|
For each of the following, you must select one of `tenderly_ethereum`, `tenderly_base`,
|
||||||
|
`ethereum`, or `base` as the network.
|
||||||
|
|
||||||
|
1. Deploy router: `npx hardhat run scripts/deploy-router.js --network NETWORK`
|
||||||
2. Define the accounts to grant roles to in `scripts/roles.json`
|
2. Define the accounts to grant roles to in `scripts/roles.json`
|
||||||
3. Export the router address to the environment variable `export ROUTER=<router-address>`
|
3. Export the router address to the environment variable `export ROUTER=<router-address>`
|
||||||
4. Grant roles: `npx hardhat run scripts/set-roles.js --network tenderly/mainnet`
|
4. Grant roles: `npx hardhat run scripts/set-roles.js --network NETWORK`
|
||||||
5. Set executors: `npx hardhat run scripts/set-executors.js --network tenderly/mainnet`. Make sure you change the
|
5. Set executors: `npx hardhat run scripts/set-executors.js --network NETWORK`. Make sure you change the
|
||||||
DEPLOY_WALLET
|
DEPLOY_WALLET to the executor deployer wallet. If you need to deploy executors, follow the instructions below.
|
||||||
to the executor deployer wallet. If you need to deploy executors, follow the instructions below.
|
|
||||||
|
|
||||||
### Deploy executors
|
### Deploy executors
|
||||||
|
|
||||||
1. In `scripts/deploy-executors.js` define the executors to be deployed
|
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`
|
2. Deploy executors: `npx hardhat run scripts/deploy-executors.js --network NETWORK`
|
||||||
3. Fill in the executor addresses in `config/executor_addresses.json`. Note that the naming there needs to match the one
|
3. Fill in the executor addresses in `config/executors.json`
|
||||||
from tycho-indexer.
|
|
||||||
|
|||||||
@@ -4,8 +4,18 @@ const hre = require("hardhat");
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const network = hre.network.name;
|
const network = hre.network.name;
|
||||||
const permit2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
let permit2;
|
||||||
const weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
let weth;
|
||||||
|
if (network === "mainnet" || network === "tenderly_mainnet") {
|
||||||
|
permit2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
||||||
|
weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
||||||
|
} else if (network === "base" || network === "tenderly_base") {
|
||||||
|
// permit2 address is the same as on mainnet
|
||||||
|
permit2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
||||||
|
weth = "0x4200000000000000000000000000000000000006";
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unsupported network: ${network}`);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`Deploying TychoRouter to ${network} with:`);
|
console.log(`Deploying TychoRouter to ${network} with:`);
|
||||||
console.log(`- permit2: ${permit2}`);
|
console.log(`- permit2: ${permit2}`);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
const {ethers} = require("hardhat");
|
const {ethers} = require("hardhat");
|
||||||
|
|
||||||
const TENDERLY_RPC_URL = process.env.TENDERLY_RPC_URL;
|
const RPC_URL = process.env.RPC_URL;
|
||||||
const DEPLOY_WALLET = process.env.DEPLOY_WALLET;
|
const DEPLOY_WALLET = process.env.DEPLOY_WALLET;
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
if (!TENDERLY_RPC_URL || !DEPLOY_WALLET) {
|
if (!RPC_URL || !DEPLOY_WALLET) {
|
||||||
console.error("Missing TENDERLY_RPC_URL or DEPLOY_WALLET in environment variables.");
|
console.error("Missing RPC_URL or DEPLOY_WALLET in environment variables.");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"ethereum": {
|
||||||
"EXECUTOR_SETTER_ROLE": [
|
"EXECUTOR_SETTER_ROLE": [
|
||||||
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
||||||
],
|
],
|
||||||
@@ -12,4 +13,50 @@
|
|||||||
"FUND_RESCUER_ROLE": [
|
"FUND_RESCUER_ROLE": [
|
||||||
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"tenderly_ethereum": {
|
||||||
|
"EXECUTOR_SETTER_ROLE": [
|
||||||
|
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
||||||
|
],
|
||||||
|
"FEE_SETTER_ROLE": [],
|
||||||
|
"PAUSER_ROLE": [
|
||||||
|
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
||||||
|
],
|
||||||
|
"UNPAUSER_ROLE": [
|
||||||
|
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
||||||
|
],
|
||||||
|
"FUND_RESCUER_ROLE": [
|
||||||
|
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"base": {
|
||||||
|
"EXECUTOR_SETTER_ROLE": [
|
||||||
|
"0xb0A77f867Fcec1e9b271Ee17354bC6bBC0dD5662"
|
||||||
|
],
|
||||||
|
"FEE_SETTER_ROLE": [],
|
||||||
|
"PAUSER_ROLE": [
|
||||||
|
"0xb0A77f867Fcec1e9b271Ee17354bC6bBC0dD5662"
|
||||||
|
],
|
||||||
|
"UNPAUSER_ROLE": [
|
||||||
|
"0xb0A77f867Fcec1e9b271Ee17354bC6bBC0dD5662"
|
||||||
|
],
|
||||||
|
"FUND_RESCUER_ROLE": [
|
||||||
|
"0xb0A77f867Fcec1e9b271Ee17354bC6bBC0dD5662"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tenderly_base": {
|
||||||
|
"EXECUTOR_SETTER_ROLE": [
|
||||||
|
"0xb0A77f867Fcec1e9b271Ee17354bC6bBC0dD5662"
|
||||||
|
],
|
||||||
|
"FEE_SETTER_ROLE": [],
|
||||||
|
"PAUSER_ROLE": [
|
||||||
|
"0xb0A77f867Fcec1e9b271Ee17354bC6bBC0dD5662"
|
||||||
|
],
|
||||||
|
"UNPAUSER_ROLE": [
|
||||||
|
"0xb0A77f867Fcec1e9b271Ee17354bC6bBC0dD5662"
|
||||||
|
],
|
||||||
|
"FUND_RESCUER_ROLE": [
|
||||||
|
"0xb0A77f867Fcec1e9b271Ee17354bC6bBC0dD5662"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ async function main() {
|
|||||||
const router = TychoRouter.attach(routerAddress);
|
const router = TychoRouter.attach(routerAddress);
|
||||||
|
|
||||||
const executorsFilePath = path.join(__dirname, "../../config/executor_addresses.json");
|
const executorsFilePath = path.join(__dirname, "../../config/executor_addresses.json");
|
||||||
const executors = Object.entries(JSON.parse(fs.readFileSync(executorsFilePath, "utf8"))["ethereum"]);
|
const executors = Object.entries(JSON.parse(fs.readFileSync(executorsFilePath, "utf8"))[network]);
|
||||||
|
|
||||||
|
|
||||||
// Filter out executors that are already set
|
// Filter out executors that are already set
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ async function main() {
|
|||||||
|
|
||||||
// Iterate through roles and grant them to the corresponding addresses
|
// Iterate through roles and grant them to the corresponding addresses
|
||||||
for (const [roleName, roleHash] of Object.entries(roles)) {
|
for (const [roleName, roleHash] of Object.entries(roles)) {
|
||||||
const addresses = rolesDict[roleName];
|
const addresses = rolesDict[network][roleName];
|
||||||
if (addresses && addresses.length > 0) {
|
if (addresses && addresses.length > 0) {
|
||||||
console.log(`Granting ${roleName} to the following addresses:`, addresses);
|
console.log(`Granting ${roleName} to the following addresses:`, addresses);
|
||||||
const tx = await router.batchGrantRole(roleHash, addresses);
|
const tx = await router.batchGrantRole(roleHash, addresses);
|
||||||
|
|||||||
Reference in New Issue
Block a user