File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
packages/payment-processor/src/payment Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ export async function payWithERC20SingleRequestProxy(
158158
159159 let tokenAddress : string ;
160160 try {
161+ // Attempt to fetch the token address from the proxy contract, to determine if it's an ERC20 SingleRequestProxy.
161162 tokenAddress = await proxyContract . tokenAddress ( ) ;
162163 } catch {
163164 throw new Error ( 'Contract is not an ERC20SingleRequestProxy' ) ;
@@ -200,10 +201,15 @@ export async function payWithEthereumSingleRequestProxy(
200201 const proxyContract = new Contract ( proxyAddress , proxyInterface , signer ) ;
201202
202203 try {
204+ // Attempt to fetch the token address from the proxy contract, to determine if it's an Ethereum SingleRequestProxy.
203205 await proxyContract . tokenAddress ( ) ;
206+
207+ // If the token address is fetched, it means the contract is an ERC20SingleRequestProxy.
204208 throw new Error ( 'Contract is not an EthereumSingleRequestProxy' ) ;
205209 } catch ( error ) {
210+ // If the token address is not fetched, it means the contract is an EthereumSingleRequestProxy.
206211 if ( error . message === 'Contract is not an EthereumSingleRequestProxy' ) {
212+ // If the error message is 'Contract is not an EthereumSingleRequestProxy', throw the error.
207213 throw error ;
208214 }
209215 }
You can’t perform that action at this time.
0 commit comments