Skip to content

Commit

Permalink
🐛 fix: Add padding to deposit eth
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Cory authored and Will Cory committed Oct 6, 2023
1 parent c1691f9 commit 5d23242
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/actions/wallet/L1/writeDepositETH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Account, Chain, Transport, WalletClient, WriteContractReturnType }
import { ABI, CONTRACT, type DepositETHParameters, FUNCTION } from '../../../types/depositETH.js'
import type { L1WriteActionBaseType } from '../../../types/l1Actions.js'
import { writeOpStackL1, type WriteOpStackL1Parameters } from './writeOpStackL1.js'
import { estimateContractGas } from 'viem/actions'

export type WriteDepositETHParameters<
TChain extends Chain | undefined = Chain,
Expand Down Expand Up @@ -33,24 +34,20 @@ export async function writeDepositETH<
args: { to, minGasLimit, extraData = '0x' },
l1StandardBridgeAddress,
...rest
}: WriteDepositETHParameters<
TChain,
TAccount,
TChainOverride
>,
}: WriteDepositETHParameters<TChain, TAccount, TChainOverride>,
): Promise<WriteContractReturnType> {
const gas = await estimateContractGas(client, {
args: { to, minGasLimit, extraData },
l1StandardBridgeAddress,
...rest,
} as any)
return writeOpStackL1(client, {
address: l1StandardBridgeAddress,
abi: ABI,
contract: CONTRACT,
functionName: FUNCTION,
gas: gas + (gas / BigInt(2)),
args: [to, minGasLimit, extraData],
...rest,
} as unknown as WriteOpStackL1Parameters<
TChain,
TAccount,
TChainOverride,
typeof ABI,
typeof FUNCTION
>)
} as unknown as WriteOpStackL1Parameters<TChain, TAccount, TChainOverride, typeof ABI, typeof FUNCTION>)
}

0 comments on commit 5d23242

Please sign in to comment.