feat: support base deployment
gas limit had to be set when setting executors on base: kept getting UNPREDICTABLE_GAS_LIMIT error. It should definitely not cost more than 100000 gas to set limit... but this may be a problem on other chains in the future.
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
|
||||
## 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:
|
||||
|
||||
```
|
||||
@@ -16,12 +17,12 @@ export PRIVATE_KEY=<private-key>
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
export RPC_URL=<mainnet-rpc-url>
|
||||
export RPC_URL=<chain-rpc-url>
|
||||
export DEPLOY_WALLET=<wallet-address>
|
||||
export PRIVATE_KEY=<private-key>
|
||||
```
|
||||
@@ -31,17 +32,18 @@ from being stored in the shell history.
|
||||
|
||||
## 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_mainnet`, `tenderly_base`,
|
||||
`mainnet`, 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`
|
||||
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`
|
||||
5. Set executors: `npx hardhat run scripts/set-executors.js --network tenderly/mainnet`. Make sure you change the
|
||||
DEPLOY_WALLET
|
||||
to the executor deployer wallet. If you need to deploy executors, follow the instructions below.
|
||||
4. Grant roles: `npx hardhat run scripts/set-roles.js --network NETWORK`
|
||||
5. Set executors: `npx hardhat run scripts/set-executors.js --network NETWORK`. Make sure you change the
|
||||
DEPLOY_WALLET to the executor deployer wallet. If you need to deploy executors, follow the instructions below.
|
||||
|
||||
### Deploy executors
|
||||
|
||||
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 `config/executor_addresses.json`. Note that the naming there needs to match the one
|
||||
from tycho-indexer.
|
||||
2. Deploy executors: `npx hardhat run scripts/deploy-executors.js --network NETWORK`
|
||||
3. Fill in the executor addresses in `config/executors.json`
|
||||
|
||||
@@ -4,8 +4,18 @@ const hre = require("hardhat");
|
||||
|
||||
async function main() {
|
||||
const network = hre.network.name;
|
||||
const permit2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
||||
const weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
||||
let permit2;
|
||||
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(`- permit2: ${permit2}`);
|
||||
|
||||
0
foundry/scripts/executors.json
Normal file
0
foundry/scripts/executors.json
Normal file
@@ -1,15 +1,32 @@
|
||||
{
|
||||
"EXECUTOR_SETTER_ROLE": [
|
||||
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
||||
],
|
||||
"FEE_SETTER_ROLE": [],
|
||||
"PAUSER_ROLE": [
|
||||
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
||||
],
|
||||
"UNPAUSER_ROLE": [
|
||||
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
||||
],
|
||||
"FUND_RESCUER_ROLE": [
|
||||
"0x58Dc7Bf9eD1f4890A7505D5bE4E4252978eAF655"
|
||||
]
|
||||
"mainnet": {
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ async function main() {
|
||||
const router = TychoRouter.attach(routerAddress);
|
||||
|
||||
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
|
||||
|
||||
@@ -28,7 +28,7 @@ async function main() {
|
||||
|
||||
// Iterate through roles and grant them to the corresponding addresses
|
||||
for (const [roleName, roleHash] of Object.entries(roles)) {
|
||||
const addresses = rolesDict[roleName];
|
||||
const addresses = rolesDict[network][roleName];
|
||||
if (addresses && addresses.length > 0) {
|
||||
console.log(`Granting ${roleName} to the following addresses:`, addresses);
|
||||
const tx = await router.batchGrantRole(roleHash, addresses);
|
||||
|
||||
Reference in New Issue
Block a user