@@ -27,6 +27,7 @@ const getReceivedTokenInfo = async ({
2727 fromChainId,
2828 omniBridgeInstance,
2929 receiveNativeToken,
30+ receiveUsds,
3031 toChainId,
3132 tokenAddress,
3233} : {
@@ -35,6 +36,7 @@ const getReceivedTokenInfo = async ({
3536 tokenAddress : string
3637 omniBridgeInstance : HomeOmniMediator
3738 receiveNativeToken : boolean
39+ receiveUsds : boolean
3840} ) : Promise < { tokenOutAddress : string ; canReceiveNativeToken ?: boolean } > => {
3941 const { isDAI, isFromForeign, isFromHome, isNativeToken } = getBridgeCommonInfo ( {
4042 fromChainId,
@@ -83,6 +85,12 @@ const getReceivedTokenInfo = async ({
8385
8486 if ( isFromHome ) {
8587 // xDAI -> DAI
88+ if ( receiveUsds ) {
89+ return {
90+ tokenOutAddress : USDS_ADDRESS ,
91+ }
92+ }
93+
8694 if ( isNativeToken ) {
8795 return {
8896 tokenOutAddress : chainsConfig [ toChainId ] . bridge . DAI ,
@@ -113,10 +121,12 @@ const getReceivedTokenInfo = async ({
113121export const useBridgeTokenOutInfo = ( {
114122 fromChainId,
115123 receiveNativeToken,
124+ receiveUsds,
116125 toChainId,
117126 token,
118127} : {
119128 receiveNativeToken : boolean
129+ receiveUsds : boolean
120130 toChainId : ChainsValues
121131 fromChainId : ChainsValues
122132 token ?: Token
@@ -127,8 +137,10 @@ export const useBridgeTokenOutInfo = ({
127137 const shouldFetch = ! ! ( token && fromChainId && toChainId )
128138
129139 const { data } = useSWR (
130- shouldFetch ? [ token , fromChainId , toChainId , receiveNativeToken , 'bridgeTokenOut' ] : null ,
131- async ( [ _token , _fromChainId , _toChainId , _receiveNativeToken ] ) => {
140+ shouldFetch
141+ ? [ token , fromChainId , toChainId , receiveNativeToken , receiveUsds , 'bridgeTokenOut' ]
142+ : null ,
143+ async ( [ _token , _fromChainId , _toChainId , _receiveNativeToken , _receiveUsds ] ) => {
132144 if (
133145 _fromChainId === Chains . mainnet &&
134146 _toChainId === Chains . gnosis &&
@@ -161,6 +173,7 @@ export const useBridgeTokenOutInfo = ({
161173 tokenAddress : _token . address ,
162174 fromChainId : _fromChainId ,
163175 receiveNativeToken : _receiveNativeToken ,
176+ receiveUsds : _receiveUsds ,
164177 } )
165178
166179 // if tokenOutInfo address is ZERO_ADDRESS is a new token on the other chain and we need to handle it
0 commit comments