diff --git a/packages/contracts-rfq/CHANGELOG.md b/packages/contracts-rfq/CHANGELOG.md index 8d5041301d..8fef9ca2d6 100644 --- a/packages/contracts-rfq/CHANGELOG.md +++ b/packages/contracts-rfq/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.11](https://github.com/synapsecns/sanguine/compare/FastBridge@0.2.10...FastBridge@0.2.11) (2024-07-16) + +**Note:** Version bump only for package FastBridge + + + + + ## [0.2.10](https://github.com/synapsecns/sanguine/compare/FastBridge@0.2.9...FastBridge@0.2.10) (2024-07-03) **Note:** Version bump only for package FastBridge diff --git a/packages/contracts-rfq/deployments/bnb/.chainId b/packages/contracts-rfq/deployments/bnb/.chainId new file mode 100644 index 0000000000..f6b91e0e1f --- /dev/null +++ b/packages/contracts-rfq/deployments/bnb/.chainId @@ -0,0 +1 @@ +56 diff --git a/packages/contracts-rfq/deployments/bnb/FastBridge.json b/packages/contracts-rfq/deployments/bnb/FastBridge.json new file mode 100644 index 0000000000..e2ef45a5e5 --- /dev/null +++ b/packages/contracts-rfq/deployments/bnb/FastBridge.json @@ -0,0 +1,4 @@ +{ + "address": "0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E", + "constructorArgs": "0x000000000000000000000000bd88862fcc17de436f7bd17276c537acadda9a67" +} \ No newline at end of file diff --git a/packages/contracts-rfq/foundry.toml b/packages/contracts-rfq/foundry.toml index 5bc3dd7af3..257821c126 100644 --- a/packages/contracts-rfq/foundry.toml +++ b/packages/contracts-rfq/foundry.toml @@ -22,6 +22,7 @@ base = "${BASE_RPC}" mainnet = "${MAINNET_RPC}" optimism = "${OPTIMISM_RPC}" scroll = "${SCROLL_RPC}" +bnb = "${BNB_RPC}" [etherscan] arbitrum = { key = "${ARBITRUM_VERIFIER_KEY}", url = "${ARBITRUM_VERIFIER_URL}" } @@ -29,4 +30,5 @@ base = { key = "${BASE_VERIFIER_KEY}", url = "${BASE_VERIFIER_URL}" } mainnet = { key = "${MAINNET_VERIFIER_KEY}", url = "${MAINNET_VERIFIER_URL}" } optimism = { key = "${OPTIMISM_VERIFIER_KEY}", url = "${OPTIMISM_VERIFIER_URL}" } scroll = { key = "${SCROLL_VERIFIER_KEY}", url = "${SCROLL_VERIFIER_URL}" } +bnb = { key = "${BNB_VERIFIER_KEY}", url = "${BNB_VERIFIER_URL}" } # See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/packages/contracts-rfq/package.json b/packages/contracts-rfq/package.json index 66d4623b5c..f4149a6bec 100644 --- a/packages/contracts-rfq/package.json +++ b/packages/contracts-rfq/package.json @@ -1,7 +1,7 @@ { "name": "FastBridge", "license": "UNLICENSED", - "version": "0.2.10", + "version": "0.2.11", "description": "FastBridge contracts.", "private": true, "files": [ diff --git a/packages/synapse-interface/CHANGELOG.md b/packages/synapse-interface/CHANGELOG.md index 7047547652..4d6f2e8bc6 100644 --- a/packages/synapse-interface/CHANGELOG.md +++ b/packages/synapse-interface/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.28.2](https://github.com/synapsecns/sanguine/compare/@synapsecns/synapse-interface@0.28.1...@synapsecns/synapse-interface@0.28.2) (2024-07-16) + +**Note:** Version bump only for package @synapsecns/synapse-interface + + + + + ## [0.28.1](https://github.com/synapsecns/sanguine/compare/@synapsecns/synapse-interface@0.28.0...@synapsecns/synapse-interface@0.28.1) (2024-07-15) **Note:** Version bump only for package @synapsecns/synapse-interface diff --git a/packages/synapse-interface/package.json b/packages/synapse-interface/package.json index 58e6f3ab0c..4ea6327c2f 100644 --- a/packages/synapse-interface/package.json +++ b/packages/synapse-interface/package.json @@ -1,6 +1,6 @@ { "name": "@synapsecns/synapse-interface", - "version": "0.28.1", + "version": "0.28.2", "private": true, "engines": { "node": ">=18.18.0" diff --git a/packages/synapse-interface/pages/lifi/index.tsx b/packages/synapse-interface/pages/lifi/index.tsx index 954f130751..d937a02f71 100644 --- a/packages/synapse-interface/pages/lifi/index.tsx +++ b/packages/synapse-interface/pages/lifi/index.tsx @@ -1,23 +1,45 @@ -import Grid from '@tw/Grid' import { useEffect, useState } from 'react' -import { useAccount, useAccountEffect, useSwitchChain } from 'wagmi' - - +import { useAccount, useSwitchChain } from 'wagmi' import { LandingPageWrapper } from '@layouts/LandingPageWrapper' import StandardPageContainer from '@layouts/StandardPageContainer' import { getErc20TokenAllowance } from '@/actions/getErc20TokenAllowance' import { approveToken } from '@/utils/approveToken' import { TransactionButton } from '@/components/buttons/TransactionButton' import { useConnectModal } from '@rainbow-me/rainbowkit' +import Image from 'next/image' +import { CHAINS_BY_ID } from '@/constants/chains' -const CHAIN_IDS = [1, 42161, 10] -const LIFI_SPENDER = "0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae" +const CHAIN_IDS = [1, 56, 42161, 10] +const LIFI_SPENDER = '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae' + +const MAX_AMOUNT = 100000000000000000000000000000n const TOKENS = { - USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - USDT: '0xdac17f958d2ee523a2206206994597c13d831ec7', - WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' -} as const; + 1: { + // Ethereum Mainnet + USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + USDT: '0xdac17f958d2ee523a2206206994597c13d831ec7', + WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + }, + 42161: { + // Arbitrum + USDC: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', + USDT: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', + WETH: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', + }, + 10: { + // Optimism + USDC: '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', + USDT: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', + WETH: '0x4200000000000000000000000000000000000006', + }, + 56: { + // BSC + USDC: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', + USDT: '0x55d398326f99059ff775485246999027b3197955', + WETH: '0x4DB5a66E937A9F4473fA95b1cAF1d1E1D62E29EA', + }, +} interface TokenAllowances { [chainId: number]: { @@ -29,6 +51,7 @@ const LifiPage = () => { const { address, isConnected, chain } = useAccount() const { chains, switchChain: switchNetwork } = useSwitchChain() const { openConnectModal } = useConnectModal() + const [hoveredToken, setHoveredToken] = useState(null) const [allowances, setAllowances] = useState({}) @@ -40,11 +63,13 @@ const LifiPage = () => { for (const chainId of CHAIN_IDS) { newAllowances[chainId] = {} - for (const [tokenName, tokenAddress] of Object.entries(TOKENS)) { + for (const [tokenName, tokenAddress] of Object.entries( + TOKENS[chainId] + )) { const allowance = await getErc20TokenAllowance({ address, chainId, - tokenAddress, + tokenAddress: tokenAddress as `0x${string}`, spender: LIFI_SPENDER, }) newAllowances[chainId][tokenName] = allowance @@ -60,26 +85,24 @@ const LifiPage = () => { } }, [address, isConnected]) - const handleRevoke = async (chainId: number, tokenName: string, tokenAddress: string) => { + const handleRevoke = async (chainId: number, tokenName: string) => { if (chain?.id !== chainId) { - await switchNetwork({chainId: chainId}) + await switchNetwork({ chainId: chainId }) } + const tokenAddress = TOKENS[chainId][tokenName] await approveToken(LIFI_SPENDER, chainId, tokenAddress, 0n) - setAllowances(prev => ({ + setAllowances((prev) => ({ ...prev, [chainId]: { ...prev[chainId], - [tokenName]: 0n - } + [tokenName]: 0n, + }, })) } return ( - +
@@ -88,56 +111,110 @@ const LifiPage = () => {
- -
-
-

Li.fi / Jumper is investigating an ongoing exploit, and users should revoke approvals - Li.fi Tweet

-
-

Check to see if you have any approvals at risk below:

-
- {isConnected ? ( - CHAIN_IDS.map(chainId => ( -
-

Chain ID: {chainId}

- {Object.entries(allowances[chainId] || {}).map(([tokenName, allowance]) => ( -
- {tokenName} Allowance: {allowance.toString()} - {allowance > 0n && ( - handleRevoke(chainId, tokenName, TOKENS[tokenName])} - /> - )} -
- ))} -
- )) - ) : ( -
- new Promise((resolve) => { +
+
+

+ Li.fi / Jumper is investigating an ongoing exploit, and users + should revoke approvals{' '} + + - Li.fi Tweet + +

+
+

+ Check to see if you have any approvals at risk below: +

+
+ {isConnected ? ( + CHAIN_IDS.map((chainId) => ( +
+ + {`${chain.name} +
+ {CHAINS_BY_ID[chainId].name} +
+
+ {Object.entries(allowances[chainId] || {}).map( + ([tokenName, allowance]) => { + return ( +
+
+
{tokenName}
+
+ setHoveredToken( + allowance > MAX_AMOUNT ? tokenName : null + ) + } + onMouseLeave={() => setHoveredToken(null)} + className="hover:cursor-pointer" + > + {allowance > MAX_AMOUNT &&
UNLIMITED
} + {hoveredToken && + hoveredToken === tokenName && + allowance > 0n && ( +
+ {allowances[chainId][ + hoveredToken + ].toString()} +
+ )} +
+
+ {allowance > 0n ? ( + handleRevoke(chainId, tokenName)} + /> + ) : ( +
+ - +
+ )} +
+ ) + } + )} +
+ )) + ) : ( +
+ + new Promise((resolve) => { openConnectModal() resolve(true) - })} - /> -
- )} -
+ }) + } + /> +
+ )}
- +