diff --git a/packages/payment-processor/src/index.ts b/packages/payment-processor/src/index.ts index 178c46ec28..c1ab446f76 100644 --- a/packages/payment-processor/src/index.ts +++ b/packages/payment-processor/src/index.ts @@ -27,7 +27,7 @@ export * from './payment/encoder-approval'; export * as Escrow from './payment/erc20-escrow-payment'; export * from './payment/prepared-transaction'; export * from './payment/utils-near'; -export * from './payment/single-request-proxy'; +export * from './payment/single-request-forwarder'; import * as utils from './payment/utils'; diff --git a/packages/payment-processor/src/payment/single-request-proxy.ts b/packages/payment-processor/src/payment/single-request-forwarder.ts similarity index 54% rename from packages/payment-processor/src/payment/single-request-proxy.ts rename to packages/payment-processor/src/payment/single-request-forwarder.ts index 17c1c2b2fe..3da7174fbd 100644 --- a/packages/payment-processor/src/payment/single-request-proxy.ts +++ b/packages/payment-processor/src/payment/single-request-forwarder.ts @@ -4,24 +4,24 @@ import { getPaymentNetworkExtension, } from '@requestnetwork/payment-detection'; import { ClientTypes, ExtensionTypes, CurrencyTypes } from '@requestnetwork/types'; -import { singleRequestProxyFactoryArtifact } from '@requestnetwork/smart-contracts'; +import { singleRequestForwarderFactoryArtifact } from '@requestnetwork/smart-contracts'; import { IERC20__factory } from '@requestnetwork/smart-contracts/types'; /** - * Deploys a Single Request Proxy contract for a given request. + * Deploys a Single Request Forwarder contract for a given request. * * @param request - The request data object containing payment network and currency information. * @param signer - The Ethereum signer used to deploy the contract. - * @returns A Promise that resolves to the address of the deployed Single Request Proxy contract. + * @returns A Promise that resolves to the address of the deployed Single Request Forwarder contract. * @throws {Error} If the payment network is unsupported, payment chain is not found, payee is not found, or if there are invalid payment network values. * * @remarks - * This function supports deploying proxies for ERC20_FEE_PROXY_CONTRACT and ETH_FEE_PROXY_CONTRACT payment networks. - * It uses the SingleRequestProxyFactory contract to create either an ERC20 or Ethereum Single Request Proxy. + * This function supports deploying forwarders for ERC20_FEE_PROXY_CONTRACT and ETH_FEE_PROXY_CONTRACT payment networks. + * It uses the SingleRequestForwarderFactory contract to create either an ERC20 or Ethereum Single Request Forwarder. * The function calculates the payment reference and handles the deployment transaction, including waiting for confirmation. - * The factory address is automatically determined based on the payment chain using the singleRequestProxyFactoryArtifact. + * The factory address is automatically determined based on the payment chain using the singleRequestForwarderFactoryArtifact. */ -export async function deploySingleRequestProxy( +export async function deploySingleRequestForwarder( request: ClientTypes.IRequestData, signer: Signer, ): Promise { @@ -42,13 +42,13 @@ export async function deploySingleRequestProxy( } // Use artifact's default address for the payment chain - const singleRequestProxyFactory = singleRequestProxyFactoryArtifact.connect( + const singleRequestForwarderFactory = singleRequestForwarderFactoryArtifact.connect( paymentChain as CurrencyTypes.EvmChainName, signer, ); - if (!singleRequestProxyFactory.address) { - throw new Error(`SingleRequestProxyFactory not found on chain ${paymentChain}`); + if (!singleRequestForwarderFactory.address) { + throw new Error(`SingleRequestForwarderFactory not found on chain ${paymentChain}`); } const salt = requestPaymentNetwork?.values?.salt; @@ -73,7 +73,7 @@ export async function deploySingleRequestProxy( if (isERC20) { const tokenAddress = request.currencyInfo.value; - tx = await singleRequestProxyFactory.createERC20SingleRequestProxy( + tx = await singleRequestForwarderFactory.createERC20SingleRequestProxy( paymentRecipient, tokenAddress, paymentReference, @@ -81,7 +81,7 @@ export async function deploySingleRequestProxy( feeAmount, ); } else { - tx = await singleRequestProxyFactory.createEthereumSingleRequestProxy( + tx = await singleRequestForwarderFactory.createEthereumSingleRequestProxy( paymentRecipient, paymentReference, feeAddress, @@ -92,61 +92,64 @@ export async function deploySingleRequestProxy( const receipt = await tx.wait(); const event = receipt.events?.find( - (e) => + (e: ethers.Event) => e.event === (isERC20 ? 'ERC20SingleRequestProxyCreated' : 'EthereumSingleRequestProxyCreated'), ); if (!event) { - throw new Error('Single request proxy creation event not found'); + throw new Error('Single request forwarder creation event not found'); } - const proxyAddress = event.args?.proxyAddress || event.args?.[0]; + const forwarderAddress = event.args?.proxyAddress || event.args?.[0]; - if (!proxyAddress) { - throw new Error('Proxy address not found in event data'); + if (!forwarderAddress) { + throw new Error('Forwarder address not found in event data'); } - return proxyAddress; + return forwarderAddress; } /** - * Validates that a contract is a SingleRequestProxy by checking required methods + * Validates that a contract is a SingleRequestForwarder by checking required methods * @param proxyAddress - The address of the contract to validate * @param signer - The Ethereum signer used to interact with the contract - * @throws {Error} If the contract is not a valid SingleRequestProxy + * @throws {Error} If the contract is not a valid SingleRequestForwarder */ -async function validateSingleRequestProxy(proxyAddress: string, signer: Signer): Promise { - const proxyInterface = new ethers.utils.Interface([ +async function validateSingleRequestForwarder( + forwarderAddress: string, + signer: Signer, +): Promise { + const forwarderInterface = new ethers.utils.Interface([ 'function payee() view returns (address)', 'function paymentReference() view returns (bytes)', 'function feeAddress() view returns (address)', 'function feeAmount() view returns (uint256)', ]); - const proxyContract = new Contract(proxyAddress, proxyInterface, signer); + const forwarderContract = new Contract(forwarderAddress, forwarderInterface, signer); try { await Promise.all([ - proxyContract.payee(), - proxyContract.paymentReference(), - proxyContract.feeAddress(), - proxyContract.feeAmount(), + forwarderContract.payee(), + forwarderContract.paymentReference(), + forwarderContract.feeAddress(), + forwarderContract.feeAmount(), ]); } catch (error) { - throw new Error('Invalid SingleRequestProxy contract'); + throw new Error('Invalid SingleRequestForwarder contract'); } } /** - * Executes a payment through an ERC20SingleRequestProxy contract - * @param proxyAddress - The address of the SingleRequestProxy contract + * Executes a payment through an ERC20SingleRequestForwarder contract + * @param forwarderAddress - The address of the SingleRequestForwarder contract * @param signer - The Ethereum signer used to execute the payment transaction * @param amount - The amount to be paid - * @throws {Error} If the contract is not an ERC20SingleRequestProxy + * @throws {Error} If the contract is not an ERC20SingleRequestForwarder */ -export async function payWithERC20SingleRequestProxy( - proxyAddress: string, +export async function payWithERC20SingleRequestForwarder( + forwarderAddress: string, signer: Signer, amount: string, ): Promise { @@ -154,43 +157,43 @@ export async function payWithERC20SingleRequestProxy( throw new Error('Amount must be a positive number'); } - const proxyInterface = new ethers.utils.Interface([ + const forwarderInterface = new ethers.utils.Interface([ 'function tokenAddress() view returns (address)', ]); - const proxyContract = new Contract(proxyAddress, proxyInterface, signer); + const forwarderContract = new Contract(forwarderAddress, forwarderInterface, signer); let tokenAddress: string; try { - // Attempt to fetch the token address from the proxy contract, to determine if it's an ERC20 SingleRequestProxy. - tokenAddress = await proxyContract.tokenAddress(); + // Attempt to fetch the token address from the forwarder contract, to determine if it's an ERC20 SingleRequestForwarder. + tokenAddress = await forwarderContract.tokenAddress(); } catch { - throw new Error('Contract is not an ERC20SingleRequestProxy'); + throw new Error('Contract is not an ERC20SingleRequestForwarder'); } const erc20Contract = IERC20__factory.connect(tokenAddress, signer); - // Transfer tokens to the proxy - const transferTx = await erc20Contract.transfer(proxyAddress, amount); + // Transfer tokens to the forwarder + const transferTx = await erc20Contract.transfer(forwarderAddress, amount); await transferTx.wait(); // Trigger the proxy's receive function to finalize payment const triggerTx = await signer.sendTransaction({ - to: proxyAddress, + to: forwarderAddress, value: ethers.constants.Zero, }); await triggerTx.wait(); } /** - * Executes a payment through an EthereumSingleRequestProxy contract - * @param proxyAddress - The address of the SingleRequestProxy contract + * Executes a payment through an EthereumSingleRequestForwarder contract + * @param forwarderAddress - The address of the SingleRequestForwarder contract * @param signer - The Ethereum signer used to execute the payment transaction * @param amount - The amount to be paid - * @throws {Error} If the contract is an ERC20SingleRequestProxy + * @throws {Error} If the contract is not an EthereumSingleRequestForwarder */ -export async function payWithEthereumSingleRequestProxy( - proxyAddress: string, +export async function payWithEthereumSingleRequestForwarder( + forwarderAddress: string, signer: Signer, amount: string, ): Promise { @@ -198,28 +201,28 @@ export async function payWithEthereumSingleRequestProxy( throw new Error('Amount must be a positive number'); } - const proxyInterface = new ethers.utils.Interface([ + const forwarderInterface = new ethers.utils.Interface([ 'function tokenAddress() view returns (address)', ]); - const proxyContract = new Contract(proxyAddress, proxyInterface, signer); + const forwarderContract = new Contract(forwarderAddress, forwarderInterface, signer); try { - // Attempt to fetch the token address from the proxy contract, to determine if it's an Ethereum SingleRequestProxy. - await proxyContract.tokenAddress(); + // Attempt to fetch the token address from the forwarder contract, to determine if it's an Ethereum SingleRequestForwarder. + await forwarderContract.tokenAddress(); - // If the token address is fetched, it means the contract is an ERC20SingleRequestProxy. - throw new Error('Contract is not an EthereumSingleRequestProxy'); + // If the token address is fetched, it means the contract is an ERC20SingleRequestForwarder. + throw new Error('Contract is not an EthereumSingleRequestForwarder'); } catch (error) { - // If the token address is not fetched, it means the contract is an EthereumSingleRequestProxy. - if (error.message === 'Contract is not an EthereumSingleRequestProxy') { - // If the error message is 'Contract is not an EthereumSingleRequestProxy', throw the error. + // If the token address is not fetched, it means the contract is an EthereumSingleRequestForwarder. + if (error.message === 'Contract is not an EthereumSingleRequestForwarder') { + // If the error message is 'Contract is not an EthereumSingleRequestForwarder', throw the error. throw error; } } const tx = await signer.sendTransaction({ - to: proxyAddress, + to: forwarderAddress, value: amount, }); await tx.wait(); @@ -228,21 +231,21 @@ export async function payWithEthereumSingleRequestProxy( /** * Executes a payment through a Single Request Proxy contract. * - * @param singleRequestProxyAddress - The address of the deployed Single Request Proxy contract. + * @param singleRequestForwarderAddress - The address of the deployed Single Request Forwarder contract. * @param signer - The Ethereum signer used to execute the payment transaction. * @param amount - The amount to be paid, as a string representation of the value. * @returns A Promise that resolves when the payment transaction is confirmed. - * @throws {Error} If the SingleRequestProxy contract is invalid. - * @throws {Error} If the proxy contract type cannot be determined, or if any transaction fails. + * @throws {Error} If the SingleRequestForwarder contract is invalid. + * @throws {Error} If the forwarder contract type cannot be determined, or if any transaction fails. * * @remarks * This function supports both ERC20 and Ethereum payments. - * For ERC20 payments, it first transfers the tokens to the proxy contract and then triggers the payment. - * For Ethereum payments, it directly sends the Ether to the proxy contract. + * For ERC20 payments, it first transfers the tokens to the forwarder contract and then triggers the payment. + * For Ethereum payments, it directly sends the Ether to the forwarder contract. * The function automatically detects whether the proxy is for ERC20 or Ethereum based on the contract interface. */ -export async function payRequestWithSingleRequestProxy( - singleRequestProxyAddress: string, +export async function payRequestWithSingleRequestForwarder( + singleRequestForwarderAddress: string, signer: Signer, amount: string, ): Promise { @@ -250,26 +253,26 @@ export async function payRequestWithSingleRequestProxy( throw new Error('Amount must be a positive number'); } - // Validate the SingleRequestProxy contract - await validateSingleRequestProxy(singleRequestProxyAddress, signer); + // Validate the SingleRequestForwarder contract + await validateSingleRequestForwarder(singleRequestForwarderAddress, signer); - const proxyInterface = new ethers.utils.Interface([ + const forwarderInterface = new ethers.utils.Interface([ 'function tokenAddress() view returns (address)', ]); - const proxyContract = new Contract(singleRequestProxyAddress, proxyInterface, signer); + const forwarderContract = new Contract(singleRequestForwarderAddress, forwarderInterface, signer); let isERC20: boolean; try { - await proxyContract.tokenAddress(); + await forwarderContract.tokenAddress(); isERC20 = true; } catch { isERC20 = false; } if (isERC20) { - await payWithERC20SingleRequestProxy(singleRequestProxyAddress, signer, amount); + await payWithERC20SingleRequestForwarder(singleRequestForwarderAddress, signer, amount); } else { - await payWithEthereumSingleRequestProxy(singleRequestProxyAddress, signer, amount); + await payWithEthereumSingleRequestForwarder(singleRequestForwarderAddress, signer, amount); } } diff --git a/packages/payment-processor/test/payment/single-request-proxy.test.ts b/packages/payment-processor/test/payment/single-request-forwarder.test.ts similarity index 75% rename from packages/payment-processor/test/payment/single-request-proxy.test.ts rename to packages/payment-processor/test/payment/single-request-forwarder.test.ts index 7db5bb8f41..1b96ed9dbb 100644 --- a/packages/payment-processor/test/payment/single-request-proxy.test.ts +++ b/packages/payment-processor/test/payment/single-request-forwarder.test.ts @@ -1,4 +1,4 @@ -import { singleRequestProxyFactoryArtifact } from '@requestnetwork/smart-contracts'; +import { singleRequestForwarderFactoryArtifact } from '@requestnetwork/smart-contracts'; import { TestERC20__factory } from '@requestnetwork/smart-contracts/types'; import { ClientTypes, @@ -9,11 +9,11 @@ import { } from '@requestnetwork/types'; import { providers, Wallet, utils } from 'ethers'; import { - deploySingleRequestProxy, - payRequestWithSingleRequestProxy, - payWithEthereumSingleRequestProxy, - payWithERC20SingleRequestProxy, -} from '../../src/payment/single-request-proxy'; + deploySingleRequestForwarder, + payRequestWithSingleRequestForwarder, + payWithEthereumSingleRequestForwarder, + payWithERC20SingleRequestForwarder, +} from '../../src/payment/single-request-forwarder'; const mnemonic = 'candy maple cake sugar pudding cream honey rich smooth crumble sweet treat'; const paymentAddress = '0x1234567890123456789012345678901234567890'; @@ -130,17 +130,17 @@ describe('deploySingleRequestProxy', () => { }; await expect( - deploySingleRequestProxy(invalidRequestUnsupportedPaymentNetwork, wallet), + deploySingleRequestForwarder(invalidRequestUnsupportedPaymentNetwork, wallet), ).rejects.toThrow('Unsupported payment network'); }); it('should throw error if request has no network', async () => { const invalidRequestWithoutNetwork = { ...ethRequest, currencyInfo: {} }; - // @ts-expect-error: Request with empty currencyInfo - await expect(deploySingleRequestProxy(invalidRequestWithoutNetwork, wallet)).rejects.toThrow( - 'Payment chain not found', - ); + await expect( + // @ts-expect-error: Request with empty currencyInfo + deploySingleRequestForwarder(invalidRequestWithoutNetwork, wallet), + ).rejects.toThrow('Payment chain not found'); }); it('should throw error if request has no network values', async () => { @@ -155,24 +155,27 @@ describe('deploySingleRequestProxy', () => { }; await expect( - deploySingleRequestProxy(invalidRequestWithoutNetworkValues, wallet), + deploySingleRequestForwarder(invalidRequestWithoutNetworkValues, wallet), ).rejects.toThrow('Invalid payment network values'); }); it('should throw an error if the request has no extension', async () => { const invalidRequestWithoutExtensions = { ...ethRequest, extensions: {} }; - await expect(deploySingleRequestProxy(invalidRequestWithoutExtensions, wallet)).rejects.toThrow( - 'Unsupported payment network', - ); + await expect( + deploySingleRequestForwarder(invalidRequestWithoutExtensions, wallet), + ).rejects.toThrow('Unsupported payment network'); }); it('should deploy EthereumSingleRequestProxy and emit event', async () => { - const singleRequestProxyFactory = singleRequestProxyFactoryArtifact.connect('private', wallet); + const singleRequestProxyFactory = singleRequestForwarderFactoryArtifact.connect( + 'private', + wallet, + ); const initialBlock = await provider.getBlockNumber(); - const proxyAddress = await deploySingleRequestProxy(ethRequest, wallet); + const proxyAddress = await deploySingleRequestForwarder(ethRequest, wallet); expect(proxyAddress).toBeDefined(); expect(typeof proxyAddress).toBe('string'); @@ -203,11 +206,14 @@ describe('deploySingleRequestProxy', () => { }); it('should deploy ERC20SingleRequestProxy and emit event', async () => { - const singleRequestProxyFactory = singleRequestProxyFactoryArtifact.connect('private', wallet); + const singleRequestProxyFactory = singleRequestForwarderFactoryArtifact.connect( + 'private', + wallet, + ); const initialBlock = await provider.getBlockNumber(); - const proxyAddress = await deploySingleRequestProxy(erc20Request, wallet); + const proxyAddress = await deploySingleRequestForwarder(erc20Request, wallet); expect(proxyAddress).toBeDefined(); expect(typeof proxyAddress).toBe('string'); @@ -241,25 +247,25 @@ describe('deploySingleRequestProxy', () => { it('should throw error when trying to pay with invalid single request proxy', async () => { const invalidProxy = '0x1234567890123456789012345678901234567890'; - await expect(payRequestWithSingleRequestProxy(invalidProxy, wallet, '100')).rejects.toThrow( - 'Invalid SingleRequestProxy contract', + await expect(payRequestWithSingleRequestForwarder(invalidProxy, wallet, '100')).rejects.toThrow( + 'Invalid SingleRequestForwarder contract', ); }); it('should throw error when amount is not a positive number', async () => { - const proxyAddress = await deploySingleRequestProxy(ethRequest, wallet); + const proxyAddress = await deploySingleRequestForwarder(ethRequest, wallet); - await expect(payRequestWithSingleRequestProxy(proxyAddress, wallet, '0')).rejects.toThrow( + await expect(payRequestWithSingleRequestForwarder(proxyAddress, wallet, '0')).rejects.toThrow( 'Amount must be a positive number', ); }); it('should pay with EthereumSingleRequestProxy', async () => { - const proxyAddress = await deploySingleRequestProxy(ethRequest, wallet); + const proxyAddress = await deploySingleRequestForwarder(ethRequest, wallet); const walletBalanceBefore = await provider.getBalance(wallet.address); - await payRequestWithSingleRequestProxy(proxyAddress, wallet, '1000'); + await payRequestWithSingleRequestForwarder(proxyAddress, wallet, '1000'); const walletBalanceAfter = await provider.getBalance(wallet.address); @@ -276,11 +282,11 @@ describe('deploySingleRequestProxy', () => { currencyInfo: { ...erc20Request.currencyInfo, value: testERC20.address }, }; - const proxyAddress = await deploySingleRequestProxy(updatedERC20Request, wallet); + const proxyAddress = await deploySingleRequestForwarder(updatedERC20Request, wallet); const initialProxyBalance = await testERC20.balanceOf(wallet.address); - await payRequestWithSingleRequestProxy(proxyAddress, wallet, amount); + await payRequestWithSingleRequestForwarder(proxyAddress, wallet, amount); const finalProxyBalance = await testERC20.balanceOf(wallet.address); @@ -290,28 +296,28 @@ describe('deploySingleRequestProxy', () => { describe('payWithEthereumSingleRequestProxy', () => { it('should throw error when amount is not a positive number', async () => { - const proxyAddress = await deploySingleRequestProxy(ethRequest, wallet); + const proxyAddress = await deploySingleRequestForwarder(ethRequest, wallet); - await expect(payWithEthereumSingleRequestProxy(proxyAddress, wallet, '0')).rejects.toThrow( + await expect(payWithEthereumSingleRequestForwarder(proxyAddress, wallet, '0')).rejects.toThrow( 'Amount must be a positive number', ); }); it('should throw error when contract is an ERC20SingleRequestProxy', async () => { - const proxyAddress = await deploySingleRequestProxy(erc20Request, wallet); + const proxyAddress = await deploySingleRequestForwarder(erc20Request, wallet); - await expect(payWithEthereumSingleRequestProxy(proxyAddress, wallet, '1000')).rejects.toThrow( - 'Contract is not an EthereumSingleRequestProxy', - ); + await expect( + payWithEthereumSingleRequestForwarder(proxyAddress, wallet, '1000'), + ).rejects.toThrow('Contract is not an EthereumSingleRequestForwarder'); }); it('should successfully pay with ETH', async () => { - const proxyAddress = await deploySingleRequestProxy(ethRequest, wallet); + const proxyAddress = await deploySingleRequestForwarder(ethRequest, wallet); const amount = '1000'; const walletBalanceBefore = await provider.getBalance(wallet.address); - await payWithEthereumSingleRequestProxy(proxyAddress, wallet, amount); + await payWithEthereumSingleRequestForwarder(proxyAddress, wallet, amount); const walletBalanceAfter = await provider.getBalance(wallet.address); @@ -321,18 +327,18 @@ describe('payWithEthereumSingleRequestProxy', () => { describe('payWithERC20SingleRequestProxy', () => { it('should throw error when amount is not a positive number', async () => { - const proxyAddress = await deploySingleRequestProxy(erc20Request, wallet); + const proxyAddress = await deploySingleRequestForwarder(erc20Request, wallet); - await expect(payWithERC20SingleRequestProxy(proxyAddress, wallet, '0')).rejects.toThrow( + await expect(payWithERC20SingleRequestForwarder(proxyAddress, wallet, '0')).rejects.toThrow( 'Amount must be a positive number', ); }); it('should throw error when contract is not an ERC20SingleRequestProxy', async () => { - const proxyAddress = await deploySingleRequestProxy(ethRequest, wallet); + const proxyAddress = await deploySingleRequestForwarder(ethRequest, wallet); - await expect(payWithERC20SingleRequestProxy(proxyAddress, wallet, '1000')).rejects.toThrow( - 'Contract is not an ERC20SingleRequestProxy', + await expect(payWithERC20SingleRequestForwarder(proxyAddress, wallet, '1000')).rejects.toThrow( + 'Contract is not an ERC20SingleRequestForwarder', ); }); @@ -345,10 +351,10 @@ describe('payWithERC20SingleRequestProxy', () => { currencyInfo: { ...erc20Request.currencyInfo, value: testERC20.address }, }; - const proxyAddress = await deploySingleRequestProxy(updatedERC20Request, wallet); + const proxyAddress = await deploySingleRequestForwarder(updatedERC20Request, wallet); const initialBalance = await testERC20.balanceOf(wallet.address); - await payWithERC20SingleRequestProxy(proxyAddress, wallet, amount); + await payWithERC20SingleRequestForwarder(proxyAddress, wallet, amount); const finalBalance = await testERC20.balanceOf(wallet.address); diff --git a/packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts b/packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts index 61f16c0d9c..4f9861587f 100644 --- a/packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts +++ b/packages/smart-contracts/scripts-create2/contract-setup/setupSingleRequestProxyFactory.ts @@ -1,5 +1,5 @@ import { EvmChains } from '@requestnetwork/currency'; -import { singleRequestProxyFactoryArtifact } from '../../src/lib'; +import { singleRequestForwarderFactoryArtifact } from '../../src/lib'; import { HardhatRuntimeEnvironmentExtended } from '../types'; import { getSignerAndGasFees, @@ -28,16 +28,16 @@ export const setupSRPF = async ({ try { EvmChains.assertChainSupported(network); if (!contractAddress) { - contractAddress = singleRequestProxyFactoryArtifact.getAddress(network); + contractAddress = singleRequestForwarderFactoryArtifact.getAddress(network); } if (!contractAddress) { - console.warn(`Missing SingleRequestProxyFactory deployment on ${network}`); + console.warn(`Missing SingleRequestForwarderFactory deployment on ${network}`); return; } const factory = new hre.ethers.Contract( contractAddress, - singleRequestProxyFactoryArtifact.getContractAbi(), + singleRequestForwarderFactoryArtifact.getContractAbi(), ); const { signer, txOverrides } = await getSignerAndGasFees(network, hre); const factoryConnected = factory.connect(signer); @@ -57,10 +57,10 @@ export const setupSRPF = async ({ signWithEoa, ); - console.log(`Setup of SingleRequestProxyFactory successful on ${network}`); + console.log(`Setup of SingleRequestForwarderFactory successful on ${network}`); } catch (err) { console.warn( - `An error occurred during the setup of SingleRequestProxyFactory on ${network}`, + `An error occurred during the setup of SingleRequestForwarderFactory on ${network}`, ); console.warn(err); } diff --git a/packages/smart-contracts/scripts-create2/utils.ts b/packages/smart-contracts/scripts-create2/utils.ts index b71761ae85..6301f58e2b 100644 --- a/packages/smart-contracts/scripts-create2/utils.ts +++ b/packages/smart-contracts/scripts-create2/utils.ts @@ -58,7 +58,7 @@ export const getArtifact = (contract: string): artifacts.ContractArtifact( - { - '0.1.0': { - abi: ABI_0_1_0, - deployment: { - private: { - address: '0x9d075ae44D859191C121d7522da0Cc3B104b8837', - creationBlockNumber: 0, - }, - sepolia: { - address: '0xf8cACE7EE4c03Eb4f225434B0709527938D365b4', - creationBlockNumber: 7038199, - }, - zksyncera: { - address: '0x9Fd503e723e5EfcCde3183632b443fFF49E68715', - creationBlockNumber: 48690095, - }, - base: { - address: '0xAdc0001eA67Ab36D5321612c6b500572704fFF20', - creationBlockNumber: 22154500, - }, - matic: { - address: '0x4D417AA04DBb207201a794E5B7381B3cde815281', - creationBlockNumber: 64048143, - }, - avalanche: { - address: '0x4D417AA04DBb207201a794E5B7381B3cde815281', - creationBlockNumber: 52824404, - }, - optimism: { - address: '0xf8cACE7EE4c03Eb4f225434B0709527938D365b4', - creationBlockNumber: 127750366, - }, - 'arbitrum-one': { - address: '0x4D417AA04DBb207201a794E5B7381B3cde815281', - creationBlockNumber: 272440350, - }, - xdai: { - address: '0x4D417AA04DBb207201a794E5B7381B3cde815281', - creationBlockNumber: 36924272, - }, - bsc: { - address: '0x4D417AA04DBb207201a794E5B7381B3cde815281', - creationBlockNumber: 43839939, - }, - celo: { - address: '0x8d996a0591a0F9eB65301592C88303e07Ec481db', - creationBlockNumber: 28685655, - }, - mantle: { - address: '0xf8cACE7EE4c03Eb4f225434B0709527938D365b4', - creationBlockNumber: 71485828, - }, - mainnet: { - address: '0xD5933C74414ce80D9d7082cc89FBAdcfF4751fAF', - creationBlockNumber: 21145968, +export const singleRequestForwarderFactoryArtifact = + new ContractArtifact( + { + '0.1.0': { + abi: ABI_0_1_0, + deployment: { + private: { + address: '0x9d075ae44D859191C121d7522da0Cc3B104b8837', + creationBlockNumber: 0, + }, + sepolia: { + address: '0xf8cACE7EE4c03Eb4f225434B0709527938D365b4', + creationBlockNumber: 7038199, + }, + zksyncera: { + address: '0x9Fd503e723e5EfcCde3183632b443fFF49E68715', + creationBlockNumber: 48690095, + }, + base: { + address: '0xAdc0001eA67Ab36D5321612c6b500572704fFF20', + creationBlockNumber: 22154500, + }, + matic: { + address: '0x4D417AA04DBb207201a794E5B7381B3cde815281', + creationBlockNumber: 64048143, + }, + avalanche: { + address: '0x4D417AA04DBb207201a794E5B7381B3cde815281', + creationBlockNumber: 52824404, + }, + optimism: { + address: '0xf8cACE7EE4c03Eb4f225434B0709527938D365b4', + creationBlockNumber: 127750366, + }, + 'arbitrum-one': { + address: '0x4D417AA04DBb207201a794E5B7381B3cde815281', + creationBlockNumber: 272440350, + }, + xdai: { + address: '0x4D417AA04DBb207201a794E5B7381B3cde815281', + creationBlockNumber: 36924272, + }, + bsc: { + address: '0x4D417AA04DBb207201a794E5B7381B3cde815281', + creationBlockNumber: 43839939, + }, + celo: { + address: '0x8d996a0591a0F9eB65301592C88303e07Ec481db', + creationBlockNumber: 28685655, + }, + mantle: { + address: '0xf8cACE7EE4c03Eb4f225434B0709527938D365b4', + creationBlockNumber: 71485828, + }, + mainnet: { + address: '0xD5933C74414ce80D9d7082cc89FBAdcfF4751fAF', + creationBlockNumber: 21145968, + }, }, }, }, - }, - '0.1.0', -); + '0.1.0', + );