Skip to content

Commit

Permalink
Update deployments for new assets
Browse files Browse the repository at this point in the history
  • Loading branch information
shanefontaine committed Jul 20, 2021
1 parent a95aa71 commit 6a22b5a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export const L2_CANONICAL_TOKEN_ADDRESSES: any = {
},
OPTIMISM_MAINNET: {
USDC: 'TODO',
USDT: 'TODO'
},
OPTIMISM_TESTNET: {
KOVAN: {
Expand All @@ -213,6 +214,7 @@ export const L2_CANONICAL_TOKEN_ADDRESSES: any = {

export const COMMON_SYMBOLS: { [key: string]: string } = {
DAI: 'DAI',
USDT: 'USDT',
sETH: 'sETH',
sBTC: 'sBTC',
USDC: 'USDC',
Expand Down
5 changes: 5 additions & 0 deletions config/networks/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ export const networkData: NetworkData = {
l1CanonicalTokenAddress: L1_CANONICAL_TOKEN_ADDRESSES.MAINNET.USDC,
l2CanonicalTokenAddress: L2_CANONICAL_TOKEN_ADDRESSES.OPTIMISM_MAINNET.USDC,
...DEFAULT_NETWORK_DATA.USDC
},
USDT: {
l1CanonicalTokenAddress: L1_CANONICAL_TOKEN_ADDRESSES.MAINNET.USDT,
l2CanonicalTokenAddress: L2_CANONICAL_TOKEN_ADDRESSES.OPTIMISM_MAINNET.USDT,
...DEFAULT_NETWORK_DATA.USDT
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const desiredAccounts: string[] = [

const isOptimizerEnabled: boolean = true
// 50k for normal, 1 for Optimism
const numOptimizerRuns: number = 1
// const numOptimizerRuns: number = 50000
// const numOptimizerRuns: number = 1
const numOptimizerRuns: number = 50000

// You have to export an object to set up your config
// This object can have the following optional entries:
Expand Down
4 changes: 4 additions & 0 deletions scripts/deployAndSetupHop/setupL1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ export async function setupL1 (config: Config) {
const relayerFee: BigNumber = BigNumber.from('0')

logger.log('sending token to L2')
logger.log(
`IF THIS TRANSACTION FAILS: it may be because you are using a patched OZ. Reinstall node modules & redeploy the L1 bridge.`,
`A failed transaction here will not show any internal calls and use very little gas.`
)
modifiedGasPrice = await getModifiedGasPrice(ethers, l1ChainId)
tx = await l1_bridge
.connect(deployer)
Expand Down
14 changes: 12 additions & 2 deletions scripts/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ export const getTokenSymbolLetterCase = (tokenSymbol: string): string => {
else if (tokenSymbol.toLowerCase() === 'sbtc') return 'sBTC'
else if (tokenSymbol.toLowerCase() === 'usdc') return 'USDC'
else if (tokenSymbol.toLowerCase() === 'wbtc') return 'WBTC'
else if (tokenSymbol.toLowerCase() === 'usdt') return 'USDT'
else {
throw new Error ('Invalid token symbol getter')
}
}

export const getModifiedGasPrice = async (ethers, l1ChainId: BigNumber) => {
Expand All @@ -458,13 +462,19 @@ export const getLpSendAmount = (
let amount: BigNumber

if (l1NetworkName === 'mainnet') {
if (tokenSymbol.toLowerCase() === COMMON_SYMBOLS.USDC.toLowerCase()) {
if (
tokenSymbol.toLowerCase() === COMMON_SYMBOLS.USDC.toLowerCase() ||
tokenSymbol.toLowerCase() === COMMON_SYMBOLS.USDT.toLowerCase()
) {
amount = ethersUtils.parseUnits('2', 6)
} else {
amount = ethersUtils.parseUnits('2', 18)
}
} else {
if (tokenSymbol.toLowerCase() === COMMON_SYMBOLS.USDC.toLowerCase()) {
if (
tokenSymbol.toLowerCase() === COMMON_SYMBOLS.USDC.toLowerCase(),
tokenSymbol.toLowerCase() === COMMON_SYMBOLS.USDT.toLowerCase()
) {
amount = ethersUtils.parseUnits('1000', 6)
} else {
amount = LIQUIDITY_PROVIDER_INITIAL_BALANCE
Expand Down

0 comments on commit 6a22b5a

Please sign in to comment.