Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
brtkx committed Oct 23, 2024
1 parent 21f925b commit 171eea0
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
if: inputs.test_type != 'cctp'
uses: OffchainLabs/actions/run-nitro-test-node@a20a76172ce524832ac897bef2fa10a62ed81c29
with:
nitro-testnode-ref: adapt-bridge-amount
nitro-testnode-ref: badbcbea9b43d46e115da4d7c9f2f57c31af8431
l3-node: ${{ matrix.test.type != 'regular' }}
no-l3-token-bridge: ${{ matrix.test.type == 'regular' }}
args: >-
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/formatSpecfiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ switch (testType) {
...spec,
type: "orbit-custom-20dec",
typeName: "with L3 (20 decimals custom)",
testnodeArgs: "--l3node --l3-token-bridge --l3-fee-token --l3-fee-token-decimals 20",
});
});
break;
Expand All @@ -42,7 +41,6 @@ switch (testType) {
tests.push({
name: "cctp",
typeName: "",
testnodeArgs: "",
file: "tests/e2e/specs/**/*Cctp.cy.{js,jsx,ts,tsx}",
recordVideo: false,
type: "cctp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useLatest } from 'react-use'
import { useAccount, useNetwork, useSigner } from 'wagmi'
import { TransactionResponse } from '@ethersproject/providers'
import { twMerge } from 'tailwind-merge'
import { scaleToNativeTokenDecimals } from '@arbitrum/sdk/dist/lib/utils/lib'

import { useAppState } from '../../state'
import { getNetworkName, isNetwork } from '../../util/networks'
Expand All @@ -22,10 +23,7 @@ import { TransferPanelSummary } from './TransferPanelSummary'
import { useAppContextActions } from '../App/AppContext'
import { trackEvent } from '../../util/AnalyticsUtils'
import { TransferPanelMain } from './TransferPanelMain'
import {
isGatewayRegistered,
scaleToNativeTokenDecimals
} from '../../util/TokenUtils'
import { isGatewayRegistered } from '../../util/TokenUtils'
import { useSwitchNetworkWithConfig } from '../../hooks/useSwitchNetworkWithConfig'
import { errorToast, warningToast } from '../common/atoms/Toast'
import { useAccountType } from '../../hooks/useAccountType'
Expand Down Expand Up @@ -692,8 +690,6 @@ export function TransferPanel() {
if (!withdrawalConfirmation) return false
}

console.warn('decimals: ', nativeCurrencyDecimalsOnSourceChain)

// token approval
if (selectedToken) {
const isTokenApprovalRequired =
Expand All @@ -720,15 +716,6 @@ export function TransferPanel() {
}
}

const isTokenApprovalRequired_TestCheck =
await bridgeTransferStarter.requiresTokenApproval({
amount: amountBigNumber,
signer,
destinationAddress
})

console.warn({ isTokenApprovalRequired_TestCheck })

// show a delay in case of SCW because tx is executed in an external app
if (isSmartContractWallet) {
showDelayInSmartContractTransaction()
Expand Down Expand Up @@ -788,7 +775,6 @@ export function TransferPanel() {
}
: { transfer_type: 'native currency' }
})
console.warn({ error })
} finally {
setTransferring(false)
}
Expand Down
31 changes: 0 additions & 31 deletions packages/arb-token-bridge-ui/src/util/TokenUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,34 +502,3 @@ export async function isGatewayRegistered({
childProvider: childChainProvider
})
}

export function scaleToNativeTokenDecimals({
amount,
decimals
}: {
amount: BigNumber
decimals: number
}) {
// do nothing for 18 decimals
if (decimals === 18) {
return amount
}

if (decimals < 18) {
const scaledAmount = amount.div(
BigNumber.from(10).pow(BigNumber.from(18 - decimals))
)
// round up if necessary
if (
scaledAmount
.mul(BigNumber.from(10).pow(BigNumber.from(18 - decimals)))
.lt(amount)
) {
return scaledAmount.add(BigNumber.from(1))
}
return scaledAmount
}

// decimals > 18
return amount.mul(BigNumber.from(10).pow(BigNumber.from(decimals - 18)))
}
3 changes: 2 additions & 1 deletion packages/arb-token-bridge-ui/src/util/withdrawals/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import {
ChildToParentMessageReader,
ChildTransactionReceipt
} from '@arbitrum/sdk'
import { scaleToNativeTokenDecimals } from '@arbitrum/sdk/dist/lib/utils/lib'
import { FetchWithdrawalsFromSubgraphResult } from './fetchWithdrawalsFromSubgraph'
import { fetchErc20Data, scaleToNativeTokenDecimals } from '../TokenUtils'
import { fetchErc20Data } from '../TokenUtils'
import {
AssetType,
L2ToL1EventResult,
Expand Down
2 changes: 0 additions & 2 deletions packages/arb-token-bridge-ui/synpress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ export default defineConfig({
)
}

console.log({ isCustomFeeToken })

const userWalletAddress = await userWallet.getAddress()

// Fund the userWallet. We do this to run tests on a small amount of ETH.
Expand Down

0 comments on commit 171eea0

Please sign in to comment.