diff --git a/bridge_ui/src/components/Migration/EthereumQuickMigrate.tsx b/bridge_ui/src/components/Migration/EthereumQuickMigrate.tsx index b870dc4ef..d663faa1a 100644 --- a/bridge_ui/src/components/Migration/EthereumQuickMigrate.tsx +++ b/bridge_ui/src/components/Migration/EthereumQuickMigrate.tsx @@ -120,7 +120,6 @@ function EthereumMigrationLineItem({ useEffect(() => { if (!loaded && (poolInfo.data || poolInfo.error)) { - console.log("mounted & finished loading"); onLoadComplete(); setLoaded(true); } @@ -217,7 +216,7 @@ function EthereumMigrationLineItem({ ? "The swap pool has insufficient funds." : "" } - disabled={!sufficientPoolBalance} + disabled={!sufficientPoolBalance || migrationIsProcessing} > Convert diff --git a/bridge_ui/src/components/TokenSelectors/SolanaSourceTokenSelector.tsx b/bridge_ui/src/components/TokenSelectors/SolanaSourceTokenSelector.tsx index 5333aaabe..995aad040 100644 --- a/bridge_ui/src/components/TokenSelectors/SolanaSourceTokenSelector.tsx +++ b/bridge_ui/src/components/TokenSelectors/SolanaSourceTokenSelector.tsx @@ -301,7 +301,6 @@ export default function SolanaSourceTokenSelector( tokenList.sort(sortParsedTokenAccounts); return tokenList; }, [mintAccounts?.data, metaplex.data, nft, props.accounts, getSymbol]); - console.log(filteredOptions); const isOptionDisabled = useMemo(() => { return (value: ParsedTokenAccount) => { diff --git a/bridge_ui/src/hooks/useHandleTransfer.ts b/bridge_ui/src/hooks/useHandleTransfer.ts index 6a62aef35..86462b711 100644 --- a/bridge_ui/src/hooks/useHandleTransfer.ts +++ b/bridge_ui/src/hooks/useHandleTransfer.ts @@ -58,7 +58,7 @@ import { import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry"; import parseError from "../utils/parseError"; import { signSendAndConfirm } from "../utils/solana"; -import { waitForTerraExecution, calculateTerraTax } from "../utils/terra"; +import { waitForTerraExecution } from "../utils/terra"; import useTransferTargetAddressHex from "./useTransferTargetAddress"; async function eth( @@ -198,13 +198,11 @@ async function terra( dispatch(setIsSending(true)); try { const amountParsed = parseUnits(amount, decimals).toString(); - const amountTaxed = await calculateTerraTax(amountParsed, asset); const msgs = await transferFromTerra( wallet.terraAddress, TERRA_TOKEN_BRIDGE_ADDRESS, asset, amountParsed, - amountTaxed, targetChain, targetAddress ); @@ -212,20 +210,16 @@ async function terra( msgs: [...msgs], memo: "Wormhole - Initiate Transfer", }); - console.log(result); const info = await waitForTerraExecution(result); - console.log(info); dispatch(setTransferTx({ id: info.txhash, block: info.height })); enqueueSnackbar("Transaction confirmed", { variant: "success" }); const sequence = parseSequenceFromLogTerra(info); - console.log(sequence); if (!sequence) { throw new Error("Sequence not found"); } const emitterAddress = await getEmitterAddressTerra( TERRA_TOKEN_BRIDGE_ADDRESS ); - console.log(emitterAddress); enqueueSnackbar("Fetching VAA", { variant: "info" }); const { vaaBytes } = await getSignedVAAWithRetry( CHAIN_ID_TERRA, diff --git a/bridge_ui/src/utils/terra.ts b/bridge_ui/src/utils/terra.ts index a0c703ace..138d275f9 100644 --- a/bridge_ui/src/utils/terra.ts +++ b/bridge_ui/src/utils/terra.ts @@ -1,6 +1,6 @@ import { isNativeTerra } from "@certusone/wormhole-sdk"; import { formatUnits } from "@ethersproject/units"; -import { LCDClient, Dec, Int } from "@terra-money/terra.js"; +import { LCDClient } from "@terra-money/terra.js"; import { TxResult } from "@terra-money/wallet-provider"; // import { TerraTokenMetadata } from "../hooks/useTerraTokenMap"; import { TERRA_HOST } from "./consts"; @@ -37,24 +37,3 @@ export async function waitForTerraExecution(transaction: TxResult) { } return info; } - -export async function calculateTerraTax( - amount: string, - denom: string -): Promise { - try { - // Fetch terra tax state from current chain height. - const lcd = new LCDClient(TERRA_HOST); - const taxRate = await lcd.treasury.taxRate(); - const taxCap = await lcd.treasury.taxCap(denom); - - // Calculate tax rate for the current denomination. - const untaxed = new Int(amount); - const tax = untaxed.toDec().mul(taxRate); - const cap = (taxCap.amount as Int).toDec(); - const min = new Dec((tax.constructor as any).min(tax, cap)); - return untaxed.sub(min.toInt()).toString(); - } catch(e) { - return "0"; - } -} diff --git a/sdk/js/src/token_bridge/transfer.ts b/sdk/js/src/token_bridge/transfer.ts index c57c3d281..160c5f7ff 100644 --- a/sdk/js/src/token_bridge/transfer.ts +++ b/sdk/js/src/token_bridge/transfer.ts @@ -87,7 +87,6 @@ export async function transferFromTerra( tokenBridgeAddress: string, tokenAddress: string, amount: string, - taxed: string, recipientChain: ChainId, recipientAddress: Uint8Array ) { @@ -109,7 +108,7 @@ export async function transferFromTerra( { initiate_transfer: { asset: { - amount: taxed, + amount, info: { native_token: { denom: tokenAddress, @@ -123,8 +122,7 @@ export async function transferFromTerra( }, }, { - uluna: BigNumber.from("10000") - .toString(), + uluna: BigNumber.from("10000").toString(), } ), ]