Skip to content

Commit 958ebf1

Browse files
committed
chore: add comments
1 parent 47afd3b commit 958ebf1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/payment-processor/src/payment/single-request-proxy.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)