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 7c5610c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/actions/wallet/L1/writeDepositETH.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Account, Chain, Transport, WalletClient, WriteContractReturnType } from 'viem'
import { estimateContractGas } from 'viem/actions'
import { ABI, CONTRACT, type DepositETHParameters, FUNCTION } from '../../../types/depositETH.js'
import type { L1WriteActionBaseType } from '../../../types/l1Actions.js'
import { writeOpStackL1, type WriteOpStackL1Parameters } from './writeOpStackL1.js'
Expand Down Expand Up @@ -33,24 +34,22 @@ 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, {
account: client.account,
args: [to, minGasLimit, extraData],
abi: ABI,
functionName: FUNCTION,
address: l1StandardBridgeAddress,
} 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 7c5610c

Please sign in to comment.