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

feat: transaction history for batch transfers #1851

Merged
merged 50 commits into from
Aug 22, 2024
Merged

feat: transaction history for batch transfers #1851

merged 50 commits into from
Aug 22, 2024

Conversation

brtkx
Copy link
Contributor

@brtkx brtkx commented Aug 19, 2024

PR-6 from https://www.notion.so/arbitrum/Batched-ERC20-ETH-transfers-0df3704c9aef464cb443c0b97d852465

Enable the feature with query param experiments=batch

Things to note:

  • because we can only estimate retryable.maxSubmissionCost before transfer, users may receive a bit more ETH than amount2 (amount2 + unused refunded gas). Transaction history may show more ETH than it was actually sent. We show a disclaimer for this.
  • however, we try to show the accurate amount by storing amount2 in local storage. If not found in local storage, we fallback to fetching this on chain. Edit: even then it's not accurate and the final gas cost will make it a little bit different. We show the tooltip (on amount2 hover in transaction history) explaining that amount2 is just an estimate. This tooltip is shown at all times, even for the final result (for less complexity, I don't think it matters much).

Copy link

vercel bot commented Aug 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
arbitrum-token-bridge ✅ Ready (Inspect) Visit Preview Aug 22, 2024 3:26pm

@brtkx brtkx requested a review from fionnachan August 19, 2024 17:51
fionnachan
fionnachan previously approved these changes Aug 21, 2024
}: {
l1ToL2Msg: ParentToChildMessageReader
}) => {
const childReceipt = await l1ToL2Msg.getAutoRedeemAttempt()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this will work if the retryable was manually redeemed

// we deduct gas cost from max submission fee, which leaves us with amount2 (extra ETH sent with ERC-20)
if (depositStatus === 'success') {
// if success, we use the actual gas cost
const gasCost = await getRetryableFeeOnChildChain({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnChildChain is redundant

Suggested change
const gasCost = await getRetryableFeeOnChildChain({
const retryableFee = await getRetryableFee({

Comment on lines 195 to 209
const excessGas = maxSubmissionFeeNumber - estimatedGasNumber

// based on averages and min/max values from previous hundreds of txs
if (excessGas < 0.001) {
return false
}

const estimatedGasUsedPercentage =
(estimatedGasNumber / maxSubmissionFeeNumber) * 100

if (estimatedGasUsedPercentage > 10) {
return false
}

return true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

condense this so it's quicker to get what's going on

Suggested change
const excessGas = maxSubmissionFeeNumber - estimatedGasNumber
// based on averages and min/max values from previous hundreds of txs
if (excessGas < 0.001) {
return false
}
const estimatedGasUsedPercentage =
(estimatedGasNumber / maxSubmissionFeeNumber) * 100
if (estimatedGasUsedPercentage > 10) {
return false
}
return true
const excessGasFee = maxSubmissionFeeNumber - estimatedGasNumber
const percentageGasUsed = (estimatedGasNumber / maxSubmissionFeeNumber) * 100
// heuristic for determining if it's a batch transfer (based on maxSubmissionFee)
return excessGas >= 0.001 && percentageGasUsed < 10

@fionnachan fionnachan enabled auto-merge (squash) August 22, 2024 15:27
@brtkx brtkx disabled auto-merge August 22, 2024 17:10
@brtkx brtkx enabled auto-merge (squash) August 22, 2024 17:15
@brtkx brtkx merged commit a09a468 into master Aug 22, 2024
34 checks passed
@brtkx brtkx deleted the batch-erc20-eth-6 branch August 22, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants