Skip to content

Commit 636eb96

Browse files
committed
fix: erc20 bridge issues
1 parent f4eef85 commit 636eb96

9 files changed

Lines changed: 46 additions & 40 deletions

File tree

apps/frontend/src/app/3_organisms/ERC20BridgeDialog/components/ReceiveFlow/components/ReviewScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const ReviewScreen: React.FC = () => {
3434
const bridgeService = useBridgeService();
3535
const { data: limits } = useBridgeLimits(chainId, RSK_CHAIN_ID, token);
3636
const assetDetails = useTokenDetailsByAsset(token, chainId);
37-
const { handleSubmit, transaction, isAmountValid } = useBridge({
37+
const { handleSubmit, transaction } = useBridge({
3838
sourceChain: chainId!,
3939
targetChain: RSK_CHAIN_ID,
4040
asset: token!,
@@ -198,7 +198,7 @@ export const ReviewScreen: React.FC = () => {
198198
: handleSubmit
199199
}
200200
loading={isLoading}
201-
disabled={isLoading || !isAmountValid}
201+
disabled={isLoading}
202202
className="w-full"
203203
dataAttribute="erc20-receive-confirm"
204204
/>

apps/frontend/src/app/3_organisms/ERC20BridgeDialog/components/SendFlow/components/ReviewScreen.tsx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const ReviewScreen: React.FC = () => {
3434
const sourceChain = getChainById(RSK_CHAIN_ID);
3535
const targetChain = getChainById(chainId!);
3636
const assetDetails = useTokenDetailsByAsset(token, RSK_CHAIN_ID);
37-
const { handleSubmit, transaction, isAmountValid } = useBridge({
37+
const { handleSubmit, transaction } = useBridge({
3838
sourceChain: RSK_CHAIN_ID,
3939
targetChain: chainId!,
4040
asset: token!,
@@ -142,7 +142,7 @@ export const ReviewScreen: React.FC = () => {
142142
),
143143
},
144144
{
145-
label: t(translation.transactionID),
145+
label: t(translation.rootstockTxId),
146146
value: transaction.transferHash ? (
147147
<TransactionIdRenderer
148148
hash={transaction.transferHash}
@@ -184,20 +184,6 @@ export const ReviewScreen: React.FC = () => {
184184
<span>{value}</span>
185185
</div>
186186
))}
187-
188-
{transaction.transferHash && (
189-
<div className="flex justify-between">
190-
<span>{t(translation.rootstockTxId)} </span>
191-
<span>
192-
{
193-
<TransactionIdRenderer
194-
hash={transaction.transferHash}
195-
chainId={RSK_CHAIN_ID}
196-
/>
197-
}
198-
</span>
199-
</div>
200-
)}
201187
</div>
202188

203189
<div className="mt-12">
@@ -213,7 +199,7 @@ export const ReviewScreen: React.FC = () => {
213199
: handleSubmit
214200
}
215201
loading={isLoading}
216-
disabled={isLoading || !isAmountValid}
202+
disabled={isLoading}
217203
className="w-full"
218204
dataAttribute="erc20-send-confirm"
219205
/>

apps/frontend/src/config/chains.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import { ChainId } from '@sovryn/ethers-provider';
33

44
import bobLogo from '../assets/chains/bob.svg';
55
import bscLogo from '../assets/chains/bsc.svg';
6+
import ethLogo from '../assets/chains/eth.svg';
67
import rskLogo from '../assets/chains/rsk.svg';
78
import unknownLogo from '../assets/chains/unknown.svg';
89
import { BOB } from '../constants/infrastructure/bob';
910
import { BSC } from '../constants/infrastructure/bsc';
11+
import { ETHEREUM } from '../constants/infrastructure/eth';
1012
import { FORK } from '../constants/infrastructure/fork';
1113
import { RSK } from '../constants/infrastructure/rsk';
12-
import { SEPOLIA } from '../constants/infrastructure/sepolia';
1314
import { Environments } from '../types/global';
1415

1516
const IS_MAINNET = process.env.REACT_APP_NETWORK === Environments.Mainnet;
@@ -57,6 +58,24 @@ export const APP_CHAIN_LIST: ChainWithLogo[] = [
5758
icon: bobLogo,
5859
indexer: 'https://indexer.sovryn.app/v2/gobob',
5960
},
61+
{
62+
id: ChainIds.BSC_MAINNET,
63+
label: 'BSC',
64+
token: 'BNB',
65+
publicRpcUrl: BSC.publicRpc[Environments.Mainnet],
66+
rpcUrl: BSC.rpc[Environments.Mainnet],
67+
blockExplorerUrl: BSC.explorer[Environments.Mainnet],
68+
icon: bscLogo,
69+
},
70+
{
71+
id: ChainIds.MAINNET,
72+
label: 'Ethereum',
73+
token: 'ETH',
74+
publicRpcUrl: ETHEREUM.publicRpc[Environments.Mainnet],
75+
rpcUrl: ETHEREUM.rpc[Environments.Mainnet],
76+
blockExplorerUrl: ETHEREUM.explorer[Environments.Mainnet],
77+
icon: ethLogo,
78+
},
6079
]
6180
: [
6281
{
@@ -83,10 +102,10 @@ export const APP_CHAIN_LIST: ChainWithLogo[] = [
83102
id: ChainIds.SEPOLIA,
84103
label: 'Sepolia Testnet',
85104
token: 'tETH',
86-
publicRpcUrl: SEPOLIA.publicRpc[Environments.Testnet],
87-
rpcUrl: SEPOLIA.rpc[Environments.Testnet],
88-
blockExplorerUrl: SEPOLIA.explorer[Environments.Testnet],
89-
icon: unknownLogo,
105+
publicRpcUrl: ETHEREUM.publicRpc[Environments.Testnet],
106+
rpcUrl: ETHEREUM.rpc[Environments.Testnet],
107+
blockExplorerUrl: ETHEREUM.explorer[Environments.Testnet],
108+
icon: ethLogo,
90109
},
91110
{
92111
id: ChainIds.BSC_TESTNET,
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { Environments } from '../../types/global';
22

3+
const rpc = {
4+
[Environments.Mainnet]: 'wss://bsc.sovryn.app/mainnet/websocket',
5+
[Environments.Testnet]: 'wss://bsc.sovryn.app/testnet/websocket',
6+
};
7+
38
export const BSC = {
4-
rpc: {
5-
[Environments.Testnet]: ['https://bsc-testnet-rpc.publicnode.com'],
6-
},
7-
publicRpc: {
8-
[Environments.Testnet]: 'https://bsc-testnet-rpc.publicnode.com',
9-
},
9+
rpc,
10+
publicRpc: rpc,
1011
explorer: {
11-
[Environments.Testnet]: 'https://testnet.bscscan.com/',
12+
[Environments.Mainnet]: 'https://bscscan.com',
13+
[Environments.Testnet]: 'https://testnet.bscscan.com',
1214
},
1315
};

apps/frontend/src/constants/infrastructure/sepolia.ts renamed to apps/frontend/src/constants/infrastructure/eth.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { Environments } from '../../types/global';
22

33
const rpc = {
4+
[Environments.Mainnet]: 'https://ethereum-rpc.publicnode.com',
45
[Environments.Testnet]: 'https://ethereum-sepolia-rpc.publicnode.com',
56
};
67

7-
export const SEPOLIA = {
8+
export const ETHEREUM = {
89
rpc,
910
publicRpc: rpc,
1011
explorer: {
12+
[Environments.Mainnet]: 'https://etherscan.io/',
1113
[Environments.Testnet]: 'https://sepolia.etherscan.io/',
1214
},
1315
indexer: {

apps/frontend/src/utils/clients.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ApolloClient, InMemoryCache } from '@apollo/client';
33
import { ChainIds, ChainId } from '@sovryn/ethers-provider';
44

55
import { SUBGRAPH } from '../constants/general';
6-
import { SEPOLIA } from '../constants/infrastructure/sepolia';
6+
import { ETHEREUM } from '../constants/infrastructure/eth';
77
import { isRskChain } from './chain';
88

99
export const rskClient = new ApolloClient({
@@ -35,7 +35,7 @@ export const bobClient = new ApolloClient({
3535
});
3636

3737
export const sepoliaSdexClient = new ApolloClient({
38-
uri: SEPOLIA.subgraph.testnet,
38+
uri: ETHEREUM.subgraph.testnet,
3939
cache: new InMemoryCache({
4040
resultCaching: false,
4141
}),

apps/frontend/src/utils/indexer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ChainId } from '@sovryn/ethers-provider';
22

33
import { SOVRYN_INDEXER } from '../constants/infrastructure';
44
import { BOB } from '../constants/infrastructure/bob';
5-
import { SEPOLIA } from '../constants/infrastructure/sepolia';
5+
import { ETHEREUM } from '../constants/infrastructure/eth';
66
import { Environments } from '../types/global';
77
import { isBobChain, isRskChain } from './chain';
88
import { isMainnet } from './helpers';
@@ -17,5 +17,5 @@ export const getSovrynIndexerUri = (chainId: ChainId) => {
1717
];
1818
}
1919

20-
return SEPOLIA.indexer.testnet;
20+
return ETHEREUM.indexer.testnet;
2121
};

packages/sdk/src/bridge/bridgeService.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ export class BridgeService {
129129

130130
const assetDetails = await getAssetData(asset, sourceChain);
131131
const provider = this.getProvider(sourceChain);
132-
133132
const bridgeContract = new ethers.Contract(
134133
bridge.bridgeContractAddress.toLowerCase(),
135134
BRIDGE_ABI,

packages/sdk/src/bridge/config/assets.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ export const rskToEthMainnetAssets: AssetConfig[] = [
142142
isBase: false,
143143
usesAggregator: false,
144144
aggregatorContractAddress: undefined,
145-
bridgeTokenAddress: '0xefc78fc7d48b64958315949279ba181c2114abbd',
146145
},
147146
{
148147
symbol: 'DLLR',
@@ -151,7 +150,6 @@ export const rskToEthMainnetAssets: AssetConfig[] = [
151150
isBase: true,
152151
usesAggregator: false,
153152
aggregatorContractAddress: undefined,
154-
bridgeTokenAddress: '0xc1411567d2670e24d9c4daaa7cda95686e1250aa',
155153
},
156154
{
157155
symbol: 'ETH',
@@ -160,7 +158,7 @@ export const rskToEthMainnetAssets: AssetConfig[] = [
160158
isBase: false,
161159
usesAggregator: true,
162160
aggregatorContractAddress: '0x4bf113905d7f69202106f613308bb02c84aadf2f',
163-
bridgeTokenAddress: '0xfe878227c8f334038dab20a99fc3b373ffe0a755',
161+
bridgeTokenAddress: '0xFe878227c8F334038DAb20a99fC3B373fFe0a755',
164162
},
165163
];
166164

0 commit comments

Comments
 (0)