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

🐛 fix: Add padding to deposit eth #131

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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 src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export {
type SimulateDepositERC20ReturnType,
} from './public/L1/simulateDepositERC20.js'
export {
type simulateDepositETH,
simulateDepositETH,
type SimulateDepositETHParameters,
type SimulateDepositETHReturnType,
} from './public/L1/simulateDepositETH.js'
Expand Down
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>)
}
Loading