Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evm: update deployment scripts #19

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ bash sh/deploy_token_router.sh -k PRIVATE_KEY -n NETWORK_TYPE -c CHAIN_NAME

## Initial Contract Setup

Once the contracts (`TokenRouter` and `MatchingEngine`) have been deployed, the deployment configuration file needs to be updated with the deployed contract addresses, initial `FastTransferParameters` and `AuctionConfig`. The configuration file can be found in the `cfg` directory. Run the following commands for each `TokenRouter` contract (in the following order):
Once the contracts (`TokenRouter` and `MatchingEngine`) have been deployed, the deployment configuration file needs to be updated with the deployed contract addresses, initial `FastTransferParameters` and `AuctionConfig`. The configuration file can be found in the `cfg` directory. Copy the sample testnet file and replace the network type with your network of choice. Run the following commands for each `TokenRouter` contract (in the following order):

```
bash sh/setup_token_router.sh -k PRIVATE_KEY -n NETWORK_TYPE -c CHAIN_NAME
Expand Down
38 changes: 0 additions & 38 deletions evm/cfg/deployment.testnet.json

This file was deleted.

29 changes: 29 additions & 0 deletions evm/cfg/deployment.testnet.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"matchingEngine": {
"chain": 6,
"address": "0x"
},
"routers": {
"6": {
"address": "0x",
"mintRecipient": "0x",
"domain": "1"
},
"10002": {
"address": "0x",
"mintRecipient": "0x",
"domain": "0"
},
"10003": {
"address": "0x",
"mintRecipient": "0x",
"domain": "3"
}
},
"fastTransferParameters": {
"enabled": true,
"maxAmount": 5000000000,
"baseFee": 50000,
"initAuctionFee": 250000
}
}
7 changes: 4 additions & 3 deletions evm/env/testnet/arbitrum_sepolia.env
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ export RELEASE_OWNER_ASSISTANT_ADDRESS=0x


### Token Router Proxy (evm address)
export RELEASE_TOKEN_ROUTER_ADDRESS=0xc1Cf3501ef0b26c8A47759F738832563C7cB014A
export RELEASE_TOKEN_ROUTER_ADDRESS=0x


############################### Matching Engine ###############################


### Matching Engine Proxy (evm address)
### Matching Engine Proxy (universal evm address)
export RELEASE_MATCHING_ENGINE_CHAIN=6
export RELEASE_MATCHING_ENGINE_ADDRESS=0xdf5af760f3093034C7A6580FBd4CE66A8bEDd90A
export RELEASE_MATCHING_ENGINE_ADDRESS=0x
export RELEASE_MATCHING_ENGINE_MINT_RECIPIENT=0x
export RELEASE_MATCHING_ENGINE_DOMAIN=1


Expand Down
7 changes: 4 additions & 3 deletions evm/env/testnet/avalanche.env
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ export RELEASE_FEE_RECIPIENT_ADDRESS=0x
############################### Token Router #################################

### Token Router Proxy (evm address)
export RELEASE_TOKEN_ROUTER_ADDRESS=0x7353B29FDc79435dcC7ECc9Ac9F9b61d83B4E0F4
export RELEASE_TOKEN_ROUTER_ADDRESS=0x


############################### Matching Engine ###############################

### Matching Engine Proxy (evm address)
### Matching Engine Proxy (universal evm address)
export RELEASE_MATCHING_ENGINE_CHAIN=6
export RELEASE_MATCHING_ENGINE_ADDRESS=0xdf5af760f3093034C7A6580FBd4CE66A8bEDd90A
export RELEASE_MATCHING_ENGINE_ADDRESS=0x
export RELEASE_MATCHING_ENGINE_MINT_RECIPIENT=0x
export RELEASE_MATCHING_ENGINE_DOMAIN=1

### Auction Parameters
Expand Down
7 changes: 4 additions & 3 deletions evm/env/testnet/base_sepolia.env
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ export RELEASE_OWNER_ASSISTANT_ADDRESS=0x


### Token Router Proxy (evm address)
export RELEASE_TOKEN_ROUTER_ADDRESS=0x4452B708C01d6aD7058a7541A3A82f0aD0A1abB1
export RELEASE_TOKEN_ROUTER_ADDRESS=0x


############################### Matching Engine ###############################


### Matching Engine Proxy (evm address)
### Matching Engine Proxy (universal evm address)
export RELEASE_MATCHING_ENGINE_CHAIN=6
export RELEASE_MATCHING_ENGINE_ADDRESS=0xdf5af760f3093034C7A6580FBd4CE66A8bEDd90A
export RELEASE_MATCHING_ENGINE_ADDRESS=0x
export RELEASE_MATCHING_ENGINE_MINT_RECIPIENT=0x
export RELEASE_MATCHING_ENGINE_DOMAIN=1


Expand Down
7 changes: 4 additions & 3 deletions evm/env/testnet/optimism_sepolia.env
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ export RELEASE_OWNER_ASSISTANT_ADDRESS=0x


### Token Router Proxy (evm address)
export RELEASE_TOKEN_ROUTER_ADDRESS=0xc1Cf3501ef0b26c8A47759F738832563C7cB014A
export RELEASE_TOKEN_ROUTER_ADDRESS=0x


############################### Matching Engine ###############################


### Matching Engine Proxy (evm address)
### Matching Engine Proxy (universal evm address)
export RELEASE_MATCHING_ENGINE_CHAIN=6
export RELEASE_MATCHING_ENGINE_ADDRESS=0xdf5af760f3093034C7A6580FBd4CE66A8bEDd90A
export RELEASE_MATCHING_ENGINE_ADDRESS=0x
export RELEASE_MATCHING_ENGINE_MINT_RECIPIENT=0x
export RELEASE_MATCHING_ENGINE_DOMAIN=1


Expand Down
7 changes: 4 additions & 3 deletions evm/env/testnet/polygon.env
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ export RELEASE_OWNER_ASSISTANT_ADDRESS=0x


### Token Router Proxy (evm address)
export RELEASE_TOKEN_ROUTER_ADDRESS=0x3Ce8a3aC230Eb4bCE3688f2A1ab21d986a0A0B06
export RELEASE_TOKEN_ROUTER_ADDRESS=0x


############################### Matching Engine ###############################


### Matching Engine Proxy (evm address)
### Matching Engine Proxy (universal evm address)
export RELEASE_MATCHING_ENGINE_CHAIN=6
export RELEASE_MATCHING_ENGINE_ADDRESS=0xdf5af760f3093034C7A6580FBd4CE66A8bEDd90A
export RELEASE_MATCHING_ENGINE_ADDRESS=0x
export RELEASE_MATCHING_ENGINE_MINT_RECIPIENT=0x
export RELEASE_MATCHING_ENGINE_DOMAIN=1


Expand Down
7 changes: 4 additions & 3 deletions evm/env/testnet/sepolia.env
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ export RELEASE_OWNER_ASSISTANT_ADDRESS=0x


### Token Router Proxy (evm address)
export RELEASE_TOKEN_ROUTER_ADDRESS=0x603541d1Cf7178C407aA7369b67CB7e0274952e2
export RELEASE_TOKEN_ROUTER_ADDRESS=0x


############################### Matching Engine ###############################


### Matching Engine Proxy (evm address)
### Matching Engine Proxy (universal evm address)
export RELEASE_MATCHING_ENGINE_CHAIN=6
export RELEASE_MATCHING_ENGINE_ADDRESS=0xdf5af760f3093034C7A6580FBd4CE66A8bEDd90A
export RELEASE_MATCHING_ENGINE_ADDRESS=0x
export RELEASE_MATCHING_ENGINE_MINT_RECIPIENT=0x
export RELEASE_MATCHING_ENGINE_DOMAIN=1


Expand Down
14 changes: 11 additions & 3 deletions evm/ts/scripts/setup_matching_engine.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getConfig, ZERO_BYTES32 } from "./helpers";
import { ChainId, coalesceChainId, tryHexToNativeString } from "@certusone/wormhole-sdk";
import { IMatchingEngine__factory, IMatchingEngine } from "../src/types/";
import { RouterEndpointStruct } from "../src/types/IMatchingEngine";
import { ethers } from "ethers";

export function getArgs() {
Expand All @@ -25,10 +26,11 @@ export function getArgs() {
async function addRouterInfo(
chainId: string,
engine: IMatchingEngine,
routerEndpoint: string
routerEndpoint: RouterEndpointStruct,
domain: string
): Promise<void> {
console.log(`Adding router endpoint for chain ${chainId}`);
const tx = await engine.addRouterEndpoint(chainId, routerEndpoint);
const tx = await engine.addRouterEndpoint(chainId, routerEndpoint, domain);
const receipt = await tx.wait();
if (receipt.status === 1) {
console.log(`Txn succeeded chainId=${chainId}, txHash=${tx.hash}`);
Expand Down Expand Up @@ -84,8 +86,14 @@ async function main() {
if (routers[chainId].address == ZERO_BYTES32) {
throw Error(`Invalid endpoint for chain ${chainId}`);
}
const targetRouter = routers[chainId];

await addRouterInfo(chainId, engine, routers[chainId].address);
await addRouterInfo(
chainId,
engine,
{ router: targetRouter.address, mintRecipient: targetRouter.mintRecipient },
targetRouter.domain
);
}
}

Expand Down
8 changes: 5 additions & 3 deletions evm/ts/scripts/setup_token_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getConfig, ZERO_BYTES32 } from "./helpers";
import { coalesceChainId, tryHexToNativeString } from "@certusone/wormhole-sdk";
import { ITokenRouter__factory } from "../src/types/factories/ITokenRouter__factory";
import { ITokenRouter } from "../src/types/ITokenRouter";
import { EndpointStruct } from "../src/types/ITokenRouter";
import { ethers } from "ethers";

export function getArgs() {
Expand All @@ -26,7 +27,7 @@ export function getArgs() {
async function addRouterInfo(
chainId: string,
tokenRouter: ITokenRouter,
routerEndpoint: string,
routerEndpoint: EndpointStruct,
domain: string
): Promise<void> {
console.log(`Adding router endpoint for chain ${chainId}`);
Expand Down Expand Up @@ -84,12 +85,13 @@ async function main() {
if (routers[chainId].address == ZERO_BYTES32) {
throw Error(`Invalid endpoint for chain ${chainId}`);
}
const targetRouter = routers[chainId];

await addRouterInfo(
chainId,
tokenRouter,
routers[chainId].address,
routers[chainId].domain
{ router: targetRouter.address, mintRecipient: targetRouter.mintRecipient },
targetRouter.domain
);
}
}
Expand Down
Loading