Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(smart-contracts):batch conversion xdeployer #912

Draft
wants to merge 172 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 108 commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
71d0605
batch erc20 conversion contract and local deployment
olivier7delf Jun 1, 2022
5f7fc4f
tests batchPayments functions
olivier7delf Jul 13, 2022
eb1c4d8
clear batch contract
olivier7delf Jul 15, 2022
db22abc
add comments in smart contract
olivier7delf Jul 25, 2022
1a3e6b8
add batchEthConversionPaymentsWithReference
olivier7delf Jul 25, 2022
0ebe8b0
refacto batch contracts approval functions
olivier7delf Jul 29, 2022
1818239
PR - update batch contact - function visibility and comments
olivier7delf Aug 3, 2022
72c2a73
keep prefix underscore usage for function args
olivier7delf Aug 3, 2022
3ed489c
convention naming in batch contract and more comments
olivier7delf Aug 3, 2022
1800632
batchConv - delete chainlink implementation
olivier7delf Aug 4, 2022
1eb224d
batchConv erc20 - delete a require - add error tests
olivier7delf Aug 4, 2022
f8c2745
prettier contract
olivier7delf Aug 4, 2022
84216f7
doc: modify command to create request (#880)
rom1trt Jul 28, 2022
73cb822
chore: update escrow addresses (#886)
KolevDarko Jul 29, 2022
3e8763d
feat: goerli payment (#892)
rom1trt Aug 1, 2022
8b51b33
refactor: factorize goerli tests (#893)
rom1trt Aug 3, 2022
0f20179
feat: add goerli support (advanced-logic) (#895)
rom1trt Aug 3, 2022
3c1db98
tmp
olivier7delf Aug 2, 2022
31cf53f
any-to-erc20-proxy payment - correct documention on proxy used
olivier7delf Aug 4, 2022
f3ff088
wip
olivier7delf Aug 4, 2022
ebd3ff4
refacto receive function - add comments to test functions
olivier7delf Aug 4, 2022
1c07569
comments about unique token in smart contract
olivier7delf Aug 4, 2022
2357f60
prettier
olivier7delf Aug 4, 2022
b721ef4
Update packages/smart-contracts/src/contracts/BatchPaymentsPublic.sol
olivier7delf Aug 4, 2022
83398ea
Update packages/smart-contracts/src/contracts/BatchPaymentsPublic.sol
olivier7delf Aug 4, 2022
d5c11ec
Update packages/smart-contracts/src/contracts/BatchPaymentsPublic.sol
olivier7delf Aug 4, 2022
e704f4e
Update packages/smart-contracts/src/contracts/BatchPaymentsPublic.sol
olivier7delf Aug 4, 2022
978b701
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf Aug 4, 2022
ef4b86f
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf Aug 4, 2022
23b2980
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf Aug 4, 2022
abc5471
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf Aug 4, 2022
4367d97
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf Aug 4, 2022
4f683a3
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf Aug 4, 2022
dde44db
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf Aug 4, 2022
f20d802
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf Aug 4, 2022
a047149
Update packages/smart-contracts/src/contracts/BatchConversionPayments…
olivier7delf Aug 4, 2022
014c430
receive comment
olivier7delf Aug 4, 2022
f63d653
tmp tests fail
olivier7delf Aug 5, 2022
0c8f375
batch calcul updated and tested - it includes fees now
olivier7delf Aug 5, 2022
7cde97d
delete basicFee inside the contract - update test - refacto script to…
olivier7delf Aug 5, 2022
69b10dc
check the addresses of the contracts deployed and raise an error if n…
olivier7delf Aug 8, 2022
aa08563
smart contract add variable tenThousand
olivier7delf Aug 8, 2022
570de98
contract require message - wording
olivier7delf Aug 8, 2022
b3787cb
smart contract delete chainlink
olivier7delf Aug 8, 2022
101d9cd
revert batchPayments modif
olivier7delf Aug 8, 2022
f4c4452
merge with detached branch
olivier7delf Aug 8, 2022
2f79b95
Merge branch 'master' into feat/batch-conversion
olivier7delf Aug 8, 2022
70f9fe9
contract - remove irrelevant variable - wording uTokens
olivier7delf Aug 8, 2022
4b9f0af
renaming requestInfo into conversionDetail and requestsInfoParent int…
olivier7delf Aug 8, 2022
c2d842e
contract - clean constructor
olivier7delf Aug 9, 2022
73fa7a7
wording receive comments
olivier7delf Aug 9, 2022
04a2d92
clean packages
olivier7delf Aug 9, 2022
93fb63c
Merge branch 'master' into feat/batch-conversion
olivier7delf Aug 9, 2022
d49d1ad
Merge branch 'master' into feat/batch-conversion-payment
olivier7delf Aug 9, 2022
24c9ef4
Merge branch 'feat/batch-conversion' into feat/batch-conversion-payment
olivier7delf Aug 9, 2022
5e86486
wip
olivier7delf Aug 10, 2022
1a55c1e
refacto batch conversion ERC20 tests
olivier7delf Aug 10, 2022
8e3485d
eth batch functions tested
olivier7delf Aug 10, 2022
a5dcb32
rewording and cleaning
olivier7delf Aug 10, 2022
39199c8
refacto tests batch conversion ERC20
olivier7delf Aug 16, 2022
30e61e9
refacto tests: batch conversion Eth
olivier7delf Aug 17, 2022
c17d2ba
Merge branch 'master' into feat/batch-conversion
olivier7delf Aug 17, 2022
9285407
Merge branch 'feat/batch-conversion' into feat/batch-conversion-payment
olivier7delf Aug 17, 2022
d7e0b25
test erc20 can be run multiple time - revoke these approvals
olivier7delf Aug 17, 2022
bff175f
test swap-erc-20-fee-proxy revoke approval
olivier7delf Aug 17, 2022
b6b854c
refacto any-to-erc20-proxy to create the function checkRequestAndGetP…
olivier7delf Aug 18, 2022
8876f91
prettier
olivier7delf Aug 18, 2022
503e6ea
prettier test swap
olivier7delf Aug 18, 2022
24862d1
batch conversion proxy functions and approvals
olivier7delf Aug 18, 2022
d305475
test batch erc20
olivier7delf Aug 18, 2022
239c216
tests batch conversion payment done
olivier7delf Aug 25, 2022
0d44f52
prettier
olivier7delf Aug 25, 2022
ed525a4
clean tests and restore previous batchFee values
olivier7delf Aug 25, 2022
09f3fca
merge with master
olivier7delf Aug 25, 2022
69cb5ab
test refacto to simplify batchConvFunction
olivier7delf Aug 25, 2022
2736a8e
Merge branch 'master' into feat/batch-conversion
olivier7delf Aug 25, 2022
6bbccca
update batch conversion contract
olivier7delf Aug 26, 2022
b961daf
clean escrow
olivier7delf Aug 26, 2022
367fee4
Merge branch 'feat/batch-conversion' into feat/batch-conversion-payment
olivier7delf Aug 26, 2022
714590f
version with errors on 2 proxies
olivier7delf Aug 26, 2022
2bf4116
make proxies public
olivier7delf Aug 26, 2022
f0437d5
batch conversion deploy on rinkeby
olivier7delf Aug 26, 2022
978cd11
batch conversion deployed on goerli
olivier7delf Aug 26, 2022
d09aa03
update contract to make proxies public
olivier7delf Aug 26, 2022
75c7a3c
Merge branch 'feat/batch-conversion' into feat/deploy-batch-conversio…
olivier7delf Aug 26, 2022
9f746bc
test refacto: delete emitOneTx - path and add before - adminSigner
olivier7delf Aug 31, 2022
2a683ee
deploy instead of connect to batchProxy
olivier7delf Aug 31, 2022
65c9f94
end cleaning old test version
olivier7delf Aug 31, 2022
c6dc943
refacto new test structure
olivier7delf Aug 31, 2022
44d6372
refacto test add eth beginning
olivier7delf Aug 31, 2022
7cd6854
tests batchRouter erros
olivier7delf Sep 1, 2022
9439c7d
abi update
olivier7delf Sep 2, 2022
fc1c6d2
Merge branch 'master' into feat/batch-conversion
olivier7delf Sep 2, 2022
bc407d0
batch conv tests delete proxy global variables
olivier7delf Sep 2, 2022
3459966
test refactored
olivier7delf Sep 6, 2022
4dbf265
tests: cleaning
olivier7delf Sep 7, 2022
34e77e1
Merge branch 'feat/batch-conversion' into feat/deploy-batch-conversio…
olivier7delf Sep 7, 2022
d385a31
update batchConversionPayments proxies on rinkeby, goerli, and matic
olivier7delf Sep 7, 2022
21a4871
add type for batch payment inputs
olivier7delf Sep 7, 2022
d52958f
Merge branch 'feat/batch-conversion' into feat/deploy-batch-conversio…
olivier7delf Sep 7, 2022
68bdf3e
delete payment-processor batch
olivier7delf Sep 8, 2022
05fb4e3
Merge branch 'feat/batch-conversion' into feat/deploy-batch-conversio…
olivier7delf Sep 8, 2022
8bb8435
clean payment processor
olivier7delf Sep 9, 2022
d19a3bd
merge with master
olivier7delf Sep 14, 2022
aa18bef
add logs
olivier7delf Sep 15, 2022
0cad7b8
add batch conversion proxy address
olivier7delf Sep 15, 2022
103d432
remove batch payment deprecated - should not be deployed anymore
olivier7delf Sep 15, 2022
d92341c
add comments to batch fees
olivier7delf Sep 15, 2022
9738e7d
erase xdeployer batchpayments legacy
olivier7delf Sep 15, 2022
fa280d0
master merged
olivier7delf Sep 21, 2022
fb168a1
proxy addresses updated
olivier7delf Sep 22, 2022
256f5d6
add fee batch amount limit to batchMultiERC20ConversionPayments
olivier7delf Oct 7, 2022
1510142
batchFees amount limited for batchNoConversion erc20 functions
olivier7delf Oct 9, 2022
59a1485
batch erc20 functions tested
olivier7delf Oct 10, 2022
53e75c8
functions and test working
olivier7delf Oct 11, 2022
69d76a7
refacto smart contract and optimize gas
olivier7delf Oct 12, 2022
552ebbb
rename ConversionDetail into RequestDetail
olivier7delf Oct 12, 2022
aec302c
rename batchRouter function into batchPayment
olivier7delf Oct 12, 2022
ce934f2
typo corrections
olivier7delf Oct 12, 2022
385c36f
fix erc20 tests with batchFee value limited to 200
olivier7delf Oct 12, 2022
ccbc6d6
add the gas optimization for batch eth functions and clean tests
olivier7delf Oct 12, 2022
878c84e
test ready
olivier7delf Oct 12, 2022
1d2855d
legacy - delete BatchPayment modification
olivier7delf Oct 13, 2022
d2f0cfe
add privates functions - rename enable by skip fee USD limit - change…
olivier7delf Oct 13, 2022
05cd466
rename ETH functions into Native functions
olivier7delf Oct 13, 2022
aaf052b
abi code
olivier7delf Oct 13, 2022
6b853c2
pretty batch contract
olivier7delf Oct 13, 2022
61b2899
Merge branch 'master' into fix/btach-conversion-capped
olivier7delf Oct 13, 2022
f428ea4
update batch conversion processor
olivier7delf Oct 13, 2022
b3b5f72
update contract comment and receiver function
olivier7delf Oct 13, 2022
7a7d8b7
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf Oct 13, 2022
ac9b2a3
rename batchPayment into batchPayments
olivier7delf Oct 13, 2022
57d4e5f
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf Oct 13, 2022
93b8bb6
clean batch abi files
olivier7delf Oct 14, 2022
63ae2a1
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf Oct 14, 2022
42913a7
update payment processor batchPayments and fix one test
olivier7delf Oct 14, 2022
43baa37
add batch fee amount USD to batch payment processor and its tests
olivier7delf Oct 14, 2022
fc6887f
batch conversion payment processor functions and tests
olivier7delf Oct 17, 2022
ae46de2
increase DAI funds to tests batch payments with big amounts and be ab…
olivier7delf Oct 17, 2022
85f330e
Merge branch 'master' into fix/btach-conversion-capped
olivier7delf Oct 17, 2022
70d3fe9
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf Oct 17, 2022
1d28a64
update merge master
olivier7delf Oct 17, 2022
e7a6bff
Merge branch 'fix/btach-conversion-capped' into feat/deploy-batch-con…
olivier7delf Oct 18, 2022
fb8d60c
naming convention and update with master
olivier7delf Oct 18, 2022
da33fa4
Merge branch 'fix/btach-conversion-capped' into feat/deploy-batch-con…
olivier7delf Oct 18, 2022
fc92e94
update with batch fee amount in USD limit
olivier7delf Oct 18, 2022
1a4efd1
deployment batch conversion with fee amount USD limit
olivier7delf Oct 18, 2022
d215a6a
batch contract deployed for tests
olivier7delf Oct 18, 2022
9436290
Merge branch 'master' into fix/btach-conversion-capped
olivier7delf Oct 19, 2022
6de03f6
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf Oct 19, 2022
d98ec6b
Merge branch 'chore/payment-processor-batch-fee-usd-limited' into fea…
olivier7delf Oct 19, 2022
cf50687
contract deployed WIP verify failing
olivier7delf Oct 19, 2022
d3ba003
add Yo PR - function s comments on batch contracts
olivier7delf Oct 19, 2022
d176d6f
Merge branch 'master' into fix/btach-conversion-capped
olivier7delf Oct 19, 2022
a154712
files cleaned
olivier7delf Oct 20, 2022
502741d
contract deployed
olivier7delf Oct 20, 2022
2670ef6
naming convention and update with master
olivier7delf Oct 18, 2022
ee220e2
fix(graph retriever): null values (#961)
benjlevesque Oct 17, 2022
84431e3
fix: NEAR native timestamp precision (#963)
yomarion Oct 18, 2022
17608de
add batch proxy addresses and clean tests
olivier7delf Oct 20, 2022
478f60b
Merge branch 'fix/btach-conversion-capped' into chore/payment-process…
olivier7delf Oct 20, 2022
58b4aec
Merge branch 'chore/payment-processor-batch-fee-usd-limited' into fea…
olivier7delf Oct 20, 2022
0f56100
set not to skipFeeUSDLimit by default and fix tests with currencyMana…
olivier7delf Oct 21, 2022
1db3616
modify FAKE token and add DAI token within private currencyManager
olivier7delf Oct 24, 2022
a30f233
Revert "modify FAKE token and add DAI token within private currencyMa…
olivier7delf Oct 24, 2022
1530231
update batch payment - currencyManager and version and the associated…
olivier7delf Oct 25, 2022
ecb2c58
convention and typo corrections
olivier7delf Oct 25, 2022
6a432a8
refacto batch pay inputs - no more batch type and an options with cur…
olivier7delf Oct 26, 2022
f185d8e
Merge branch 'chore/payment-processor-batch-fee-usd-limited' into fea…
olivier7delf Oct 26, 2022
5b826c5
can deploy and setup batch contract in one cmd line
olivier7delf Oct 26, 2022
c37424f
update batch and re order hardhat order as mainnet is the slower
olivier7delf Nov 3, 2022
17a8eb8
merge with master
olivier7delf Nov 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const computeCreate2DeploymentAddressesFromList = async (
case 'Erc20ConversionProxy':
case 'ERC20EscrowToPay':
case 'BatchPayments':
case 'BatchConversionPayments':
case 'ERC20SwapToConversion': {
try {
const constructorArgs = getConstructorArgs(contract, hre.network.name);
Expand Down
14 changes: 14 additions & 0 deletions packages/smart-contracts/scripts-create2/constructor-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ export const getConstructorArgs = (contract: string, network?: string): string[]
getAdminWalletAddress(contract),
];
}
case 'BatchConversionPayments': {
if (!network) {
throw new Error(
'Batch conversion contract requires network parameter to get correct address of erc20FeeProxy, erc20ConversionFeeProxy, ethereumFeeProxy, and ethereumConversionFeeProxy',
);
}
return [
'0x0000000000000000000000000000000000000000',
'0x0000000000000000000000000000000000000000',
'0x0000000000000000000000000000000000000000',
'0x0000000000000000000000000000000000000000',
KolevDarko marked this conversation as resolved.
Show resolved Hide resolved
getAdminWalletAddress(contract),
];
}
default:
return [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { BigNumber } from 'ethers';

// Fees: 0.5%
export const REQUEST_SWAP_FEES = 5;
// Batch Fees: .3%
export const BATCH_FEE = 3;

// Batch conversion and no conversion fees: .3%
const BATCH_NO_CONVERSION_FEE = 30;
const BATCH_CONVERSION_FEE = 30;

export const updateChainlinkConversionPath = async (
contract: any,
Expand Down Expand Up @@ -50,16 +52,26 @@ export const updateRequestSwapFees = async (
}
};

/**
* Updates batch fees with/out conversion
* BATCH_NO_CONVERSION_FEE e.g: payment DAI - DAI
* BATCH_CONVERSION_FEE e.g: payment EUR - DAI
*/
export const updateBatchPaymentFees = async (
contract: any,
nonce: number,
gasPrice: BigNumber,
feesName: 'BatchNoConversionFee' | 'BatchConversionFee',
): Promise<void> => {
const feesApplied =
feesName === 'BatchNoConversionFee' ? BATCH_NO_CONVERSION_FEE : BATCH_CONVERSION_FEE;
const currentFees = await contract.batchFee();
if (currentFees !== BATCH_FEE) {
if (currentFees !== feesApplied) {
// Log is useful to have a direct view on was is being updated
console.log(`currentFees: ${currentFees.toString()}, new fees: ${BATCH_FEE}`);
await contract.setBatchFee(BATCH_FEE, { nonce: nonce, gasPrice: gasPrice });
console.log(
`${feesName}: the current fees: ${currentFees.toString()}, have been replaced by: ${feesApplied}`,
);
await contract.setBatchFee(feesApplied, { nonce: nonce, gasPrice: gasPrice });
}
};

Expand All @@ -80,17 +92,43 @@ export const updatePaymentErc20FeeProxy = async (
}
};

export const updatePaymentEthFeeProxy = async (
/**
* Update the address of a payment proxy used by batch conversion contract
*/
export const updateBatchConversionPaymentProxy = async (
contract: any,
network: string,
nonce: number,
gasPrice: BigNumber,
proxyName: 'eth' | 'ethConversion' | 'erc20' | 'erc20Conversion',
): Promise<void> => {
const ethereumFeeProxy = artifacts.ethereumFeeProxyArtifact;
const ethereumFeeProxyAddress = ethereumFeeProxy.getAddress(network);
const currentAddress = await contract.paymentEthFeeProxy();
if (currentAddress !== ethereumFeeProxyAddress) {
await contract.setPaymentEthFeeProxy(ethereumFeeProxyAddress, {
let proxyAddress: string;
let batchSetProxy: any;
let currentAddress: string;
if (proxyName === 'eth') {
proxyAddress = artifacts.ethereumFeeProxyArtifact.getAddress(network);
batchSetProxy = await contract.setPaymentEthProxy;
currentAddress = await contract.paymentEthProxy();
} else if (proxyName === 'ethConversion') {
proxyAddress = artifacts.ethConversionArtifact.getAddress(network);
batchSetProxy = await contract.setPaymentEthConversionProxy;
currentAddress = await contract.paymentEthConversionProxy();
} else if (proxyName === 'erc20') {
proxyAddress = artifacts.erc20FeeProxyArtifact.getAddress(network);
batchSetProxy = await contract.setPaymentErc20Proxy;
currentAddress = await contract.paymentErc20Proxy();
} else {
// proxyName === "erc20Conversion"
proxyAddress = artifacts.erc20ConversionProxy.getAddress(network);
batchSetProxy = await contract.setPaymentErc20ConversionProxy;
currentAddress = await contract.paymentErc20ConversionProxy();
}

if (currentAddress !== proxyAddress) {
console.log(
`${proxyName}: the current address ${currentAddress} has been replaced by: ${proxyAddress}`,
);
await batchSetProxy(proxyAddress, {
nonce: nonce,
gasPrice: gasPrice,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { batchConversionPaymentsArtifact } from '../../src/lib';
import { HardhatRuntimeEnvironmentExtended } from '../types';
import utils from '@requestnetwork/utils';
import { updateBatchPaymentFees, updateBatchConversionPaymentProxy } from './adminTasks';

/**
* Updates the values of the batch fees of the BatchConversionPayments contract, if needed
* @param contractAddress address of the BatchConversionPayments Proxy
* @param hre Hardhat runtime environment
*/
export const setupBatchConversionPayments = async (
contractAddress: string,
hre: HardhatRuntimeEnvironmentExtended,
): Promise<void> => {
// Setup contract parameters
const batchConversionPaymentContract = new hre.ethers.Contract(
contractAddress,
batchConversionPaymentsArtifact.getContractAbi(),
);
await Promise.all(
hre.config.xdeploy.networks.map(async (network) => {
console.log(`Setup BatchConversionPayments on ${network}`);
let provider;
if (network === 'celo') {
provider = utils.getCeloProvider();
} else {
provider = utils.getDefaultProvider(network);
}
const wallet = new hre.ethers.Wallet(hre.config.xdeploy.signer, provider);
const signer = wallet.connect(provider);
const batchConversionPaymentConnected = batchConversionPaymentContract.connect(signer);
const adminNonce = await signer.getTransactionCount();
const gasPrice = await provider.getGasPrice();

// start from the adminNonce, increase gasPrice if needed
const gasCoef = 2;
await Promise.all([
await updateBatchPaymentFees(
batchConversionPaymentConnected,
adminNonce,
gasPrice.mul(gasCoef),
'BatchNoConversionFee',
),
await updateBatchPaymentFees(
batchConversionPaymentConnected,
adminNonce + 1,
gasPrice.mul(gasCoef),
'BatchConversionFee',
),
await updateBatchConversionPaymentProxy(
batchConversionPaymentConnected,
network,
adminNonce + 2,
gasPrice.mul(gasCoef),
'erc20',
),
await updateBatchConversionPaymentProxy(
batchConversionPaymentConnected,
network,
adminNonce + 3,
gasPrice.mul(gasCoef),
'eth',
),
await updateBatchConversionPaymentProxy(
batchConversionPaymentConnected,
network,
adminNonce + 4,
gasPrice.mul(gasCoef),
'erc20Conversion',
),
await updateBatchConversionPaymentProxy(
batchConversionPaymentConnected,
network,
adminNonce + 5,
gasPrice.mul(gasCoef),
'ethConversion',
),
]);
}),
);
console.log('Setup for setupBatchConversionPayment successfull');
};

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HardhatRuntimeEnvironmentExtended } from '../types';
import { setupETHConversionProxy } from './setupETHConversionProxy';
import { setupBatchPayments } from './setupBatchPayments';
import { setupBatchConversionPayments } from './setupBatchConversionPayments';
import { setupERC20SwapToConversion } from './setupERC20SwapToConversion';

/**
Expand All @@ -23,8 +23,8 @@ export const setupContract = async (
await setupERC20SwapToConversion(contractAddress, hre);
break;
}
case 'BatchPayments': {
await setupBatchPayments(contractAddress, hre);
case 'BatchConversionPayments': {
await setupBatchConversionPayments(contractAddress, hre);
break;
}
default: {
Expand Down
6 changes: 3 additions & 3 deletions packages/smart-contracts/scripts-create2/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { HardhatRuntimeEnvironmentExtended } from './types';
import { xdeploy } from './xdeployer';
import { getConstructorArgs } from './constructor-args';
import { setupERC20SwapToConversion } from './contract-setup';
import { setupBatchPayments } from './contract-setup/setupBatchPayments';
import { setupBatchConversionPayments } from './contract-setup/setupBatchConversionPayments';

// Deploys, set up the contracts and returns the address
export const deployOneWithCreate2 = async (
Expand Down Expand Up @@ -72,11 +72,11 @@ export const deployWithCreate2FromList = async (
await deployOneWithCreate2({ contract, constructorArgs }, hre);
break;
}
case 'BatchPayments': {
case 'BatchConversionPayments': {
const network = hre.config.xdeploy.networks[0];
const constructorArgs = getConstructorArgs(contract, network);
const address = await deployOneWithCreate2({ contract, constructorArgs }, hre);
await setupBatchPayments(address, hre);
await setupBatchConversionPayments(address, hre);
break;
}
// Other cases to add when necessary
Expand Down
4 changes: 3 additions & 1 deletion packages/smart-contracts/scripts-create2/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const create2ContractDeploymentList = [
'Erc20ConversionProxy',
'ERC20SwapToConversion',
'ERC20EscrowToPay',
'BatchPayments',
'BatchConversionPayments',
];

/**
Expand Down Expand Up @@ -49,6 +49,8 @@ export const getArtifact = (contract: string): artifacts.ContractArtifact<Contra
return artifacts.erc20EscrowToPayArtifact;
case 'BatchPayments':
return artifacts.batchPaymentsArtifact;
case 'BatchConversionPayments':
return artifacts.batchConversionPaymentsArtifact;
default:
throw new Error('Contract unknown');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/smart-contracts/scripts-create2/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function VerifyCreate2FromList(hre: HardhatRuntimeEnvironmentExtend
await verifyOne(address, { contract, constructorArgs }, hre);
break;
}
case 'BatchPayments': {
case 'BatchConversionPayments': {
const network = hre.config.xdeploy.networks[0];
const constructorArgs = getConstructorArgs(contract, network);
address = await computeCreate2DeploymentAddress({ contract, constructorArgs }, hre);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,51 @@ export const batchConversionPaymentsArtifact = new ContractArtifact<BatchConvers
address: '0x2e335F247E91caa168c64b63104C4475b2af3942',
creationBlockNumber: 0,
},
rinkeby: {
address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
creationBlockNumber: 11338182,
},
goerli: {
address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
creationBlockNumber: 7546738,
},
mainnet: {
address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
creationBlockNumber: 15537996,
},
matic: {
address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
creationBlockNumber: 32800551,
},
bsc: {
address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
creationBlockNumber: 21349159,
},
celo: {
address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
creationBlockNumber: 15112387,
},
'arbitrum-one': {
address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
creationBlockNumber: 24718550,
},
fantom: {
address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
creationBlockNumber: 46977185,
},
avalanche: {
address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
creationBlockNumber: 19892946,
},
// KO because there are missing proxy: ERC20Conversion
// xdai: {
// address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
// creationBlockNumber: 24192455,
// },
// fuse: {
// address: '0x42c466ccF141A8EBE0Aa2ECEF06A4f4BE9a9B526',
// creationBlockNumber: 19146859,
// },
},
},
},
Expand Down